SHOW:
|
|
- or go back to the newest paste.
1 | Parts = {} | |
2 | a = Instance.new("Hint",workspace) | |
3 | coroutine.resume(coroutine.create(function() | |
4 | game:service("RunService").Stepped:connect(function() | |
5 | for _, par in pairs(Parts) do | |
6 | local gui = par[2] | |
7 | local part = par[1] | |
8 | local insize = part.Size*5 | |
9 | local inpos = part.Position*5 | |
10 | gui.Size = UDim2.new(0, insize.x, 0, insize.y) | |
11 | gui.Text = part.Text | |
12 | gui.BackgroundTransparency = part.Transparency | |
13 | gui.BackgroundColor3 = part.Color | |
14 | gui.Position = UDim2.new(0.5, (-insize.x/2)+(inpos.x), 0.5, (-insize.y/2)+(inpos.y)) | |
15 | local collided = nil | |
16 | for _, collidingpar in pairs(Parts) do | |
17 | if collidingpar ~= par then | |
18 | local gui2 = collidingpar[2] | |
19 | local collidingpart = collidingpar[1] | |
20 | local insize2 = collidingpart.Size*5 | |
21 | local inpos2 = collidingpart.Position*5 | |
22 | local pos1 = (inpos - inpos2) | |
23 | local pos2 = (inpos2 - inpos) | |
24 | if part.Anchored == false then | |
25 | if pos1.x >= -(insize2.x)/2 and pos1.x <= (insize2.x)/2 and pos1.y >= -(insize2.y)/2 and pos1.y <= (insize2.y)/2 then | |
26 | collided = {collidingpart, gui2} | |
27 | break | |
28 | end | |
29 | end | |
30 | end | |
31 | end | |
32 | if collided then | |
33 | a.Text="collided" | |
34 | local gui2 = collided[2] | |
35 | collided = collided[1] | |
36 | local insize2 = collided.Size*5 | |
37 | local inpos2 = collided.Position*5 | |
38 | local vel = (part.Velocity + pos1.unit) | |
39 | local vel2 = (collided.Velocity + pos2.unit) | |
40 | gui.Position = UDim2.new(0.5, ((-insize.x/2)+(inpos.x)), 0.5, ((-insize.y/2)+(inpos.y))) + UDim2.new(0, vel.x, 0, vel.y) | |
41 | gui2.Position = UDim2.new(0.5, ((-insize2.x/2)+(inpos2.x)), 0.5, ((-insize2.y/2)+(inpos2.y))) + UDim2.new(0, vel2.x, 0, vel2.y) | |
42 | else | |
43 | a.Text="not collided" | |
44 | end | |
45 | end | |
46 | end) | |
47 | end)) | |
48 | ||
49 | - | Me = game.Players.xSoulStealerx |
49 | + | Me = game.Players.TheProNoob2004 |
50 | ||
51 | ScreenGui = Instance.new("ScreenGui") | |
52 | ScreenGui.Name = "Physics" | |
53 | ScreenGui.Parent = Me:findFirstChild("PlayerGui") | |
54 | ||
55 | Screen = Instance.new("ImageLabel", ScreenGui) | |
56 | Screen.Size = UDim2.new(1, 0, 1, 1) | |
57 | Screen.Position = UDim2.new(0, 0, 0, -1) | |
58 | Screen.BorderSizePixel = 0 | |
59 | Screen.Image = "" | |
60 | Screen.BackgroundColor3 = Color3.new(0.5, 0.85, 1) | |
61 | ||
62 | Make = { | |
63 | Object = function() | |
64 | local obj = { | |
65 | Size = Vector2.new(5, 5), | |
66 | Position = Vector2.new(0, 0), | |
67 | Color = Color3.new(0.2, 0.35, 0.8), | |
68 | Anchored = false, | |
69 | Collide = true, | |
70 | Transparency = 0, | |
71 | Bounce = 0.3, | |
72 | Velocity = Vector2.new(0, 0), | |
73 | Text = "", | |
74 | } | |
75 | local insize = obj.Size*5 | |
76 | local inpos = obj.Position*5 | |
77 | local gui = Instance.new("TextLabel") | |
78 | gui.Size = UDim2.new(0, insize.x, 0, insize.y) | |
79 | gui.Position = UDim2.new(0.5, -(insize.x/2)+(inpos.x), 0.5, -(insize.y/2)+(inpos.y)) | |
80 | gui.Text = obj.Text | |
81 | gui.BackgroundTransparency = obj.Transparency | |
82 | gui.BackgroundColor3 = obj.Color | |
83 | gui.Parent = Screen | |
84 | table.insert(Parts, {obj, gui}) | |
85 | return obj | |
86 | end | |
87 | } | |
88 | ||
89 | wait(1) | |
90 | Make.Object().Position = Vector2.new(20, 7) | |
91 | wait(0.2) | |
92 | Make.Object().Position = Vector2.new(24.5, 7) |