So, I don't see any mistakes, neither does the output say anything wrong. I am totally confused.
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)
01 | s = game.Players.LocalPlayer:GetMouse() |
02 |
03 | s:connect( function (key) |
04 | key = key:lower() |
05 | if key = = "g" then |
06 | local f = Instance.new( "Part" , workspace) |
07 | f.Anchored = true |
08 | f.CanCollide = false |
09 | f.Position = Vector 3. new( 0 , 0 , 0 ) |
10 | for i = 1 , 500 , 0.1 do |
11 | wait( 0.1 ) |
12 | f.Size = f.Vector 3 + 1 |
13 | end |
14 | end |
15 | end ) |
The first error you have in this script is you didn't include an event!
On line 3:
1 | s:connect( function (key) |
So here it is.
1 | s.KeyDown:connect( function (key) |
Also, what's the purpose of the for loop in lines 10-13?
1 | for i = 1 , 500 , 0.1 do |
2 | wait( 0.1 ) |
3 | f.Size = f.Vector 3 + 1 |
4 | 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:
1 | for i = 1 , 500 , 0.1 do |
2 | wait( 0.1 ) |
3 | f.Size = f.Size + Vector 3. new( 1 , 1 , 1 ) |
4 | end |