So my script works in studio but when I run it on the server dose't work. how do I fix this code?
thing = nil
function onButton1Down(mouse)
local Hit = mouse.hit
local MT = mouse.target
if Hit==nil then return end
if MT==nil then return end
if MT.Parent:findFirstChild("Humanoid") ~= nil then
thing = MT.Parent.Humanoid
elseif MT.Parent:findFirstChild("Humanoid") ~= nil then
thing = MT.Parent.Zombie
else
if thing ~= nil then
thing:MoveTo(mouse.hit.p, MT)
end
end
end
function onS(mouse)
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end
script.Parent.Selected:connect(onS)

1 comment
Works thx