s = game.Players.LocalPlayer:GetMouse()
s:connect(function(key)
key = key:lower()
if key == "g" then
local f = Instance.new("Part", workspace)
f.Anchored = true
f.CanCollide = false
f.Position = Vector3.new(0,0,0)
for i = 1, 500, 0.1 do
wait(0.1)
f.Size = f.Vector3 +1
end
end
end)
The first error you have in this script is you didn't include an event!
On line 3:
s:connect(function(key)
So here it is.
s.KeyDown:connect(function(key)
Also, what's the purpose of the for loop in lines 10-13?
for i = 1, 500, 0.1 do
wait(0.1)
f.Size = f.Vector3 +1
end
This will certainly error out, since you're not adding 1 to really anything. Vector3 will not be a member of f.
If you want your part f to expand by 1 stud on all 3 axes every tenth of a second, try this instead:
for i = 1, 500, 0.1 do
wait(0.1)
f.Size = f.Size + Vector3.new(1, 1, 1)
end
1 comment
Next time put code into a code box. Thanks!