Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I made a script and isn't working for some reason?

Why isn't this script working?; please help:

local move = script.Parent local moveto = script.Parent

function onTouch(brick) local Player = brick.Parent:FindFirstChild("humanoid") if(Player~=nil)then move.CFrame = CFrame.new(moveto.Position+Vector3.new(1,10,1))

end

end move.Touched:Connect(onTouch)

1 comment

0

Its not humanoid , Its Humanoid

2 answers

this is the code again, it looks weird in the question:

local move = script.Parent local moveto = script.Parent

function onTouch(brick) local Player = brick.Parent:FindFirstChild("humanoid") if(Player~=nil)then move.CFrame = CFrame.new(moveto.Position+Vector3.new(1,10,1))

end

end move.Touched:Connect(onTouch)

1 comment

0

please post it in the right format then i can help you out

###Format code into code blocks by clicking the blue Lua icon and paste the code in between the tildes like this:

https://gyazo.com/e66b214f97e2373c57288770922d2ead

local Part = script.Parent
local onTouch

onTouch = function(part)
    local Player = part.Parent:FindFirstChild("Humanoid") -- uppercase "H"

    if Player then -- no need for () or ~= nil
        Part.CFrame = CFrame.new(Part.Position + Vector3.new(1, 10, 1)
    end
end

Part.Touched:Connect(onTouch)

1 comment

0

this isn't an answer, this should be a comment, but I agree

This discussion is preserved as it was. New answers, comments, and votes are closed.