I'm making a script that uses WASD to control the path of a tornado.
This is my keydown script:
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
mouse.KeyDown:connect(function(key)
if key == "a" then
game.Workspace.Direction.Value = "West"
elseif key == "w" then
game.Workspace.Direction.Value = "North"
elseif key == "s" then
game.Workspace.Direction.Value = "South"
elseif key == "d" then
game.Workspace.Direction.Value = "East"
end
end)
and this is my tornado animation script:
while true do
torx = script.Parent.Position.X
torz = script.Parent.Position.Z
if game.Workspace.Direction.Value == "West" then
x = torx-1
script.Parent.Position = Vector3.new(x,96.5,torz)
elseif game.Workspace.Direction.Value == "East" then
x = torx+1
script.Parent.Position = Vector3.new(x,96.5,torz)
elseif game.Workspace.Direction.Value == "North" then
z = torz-1
script.Parent.Position = Vector3.new(torx,96.5,z)
elseif game.Workspace.Direction.Value == "South" then
z = torz+1
script.Parent.Position = Vector3.new(torx,96.5,z)
else
print"nuffin"
end
wait(1)
end
When I press the keys, the Direction value is telling me one of the 4 directions, but the tornado doesn't move. Note that the script keeps printing "nuffin", so it doesn't see the value change.
What can be done to fix this? Thanks!

1 comment
Xd I'm trying the same thing