Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why isn't the ClickDetector doing anything?

Asked by 5 years ago
Edited 5 years ago

Here's the script:

script.Parent.ClickDetector.MouseClick:Connect(function()
    game.Players.LocalPlayer.Character.UpperTorso.CFrame = CFrame.new(-41.544, 3.254, -8.141)
end)

It's a simple script, but every time I click the part nothing happens, This script has worked fine without any problems before, Why isn't it working?

0
accept my answer EmbeddedHorror 299 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

You can't access LocalPlayer from a serverscript. MouseClick takes a parameter of the player who clicked.


script.Parent.ClickDetector.MouseClick:Connect(function(plr) plr.Character.UpperTorso.CFrame = CFrame.new(-41.544, 3.254, -8.141) end)
0
Thanks, this worked! SuperFuture_Noob 2 — 5y
0
accept as answer EmbeddedHorror 299 — 5y
0
Stop being xp hungry mc3334 649 — 5y
Ad

Answer this question