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

I made this clicking script but it doesn't work?

Asked by 6 years ago

I wanted the script to: when you click a player there gui get's disabled and there torso turns read

--Made by Jxonathan
Player = game.Players.LocalPlayer

Character = Player.Character or Player.Character:wait()

if Player.Character ~= nil then
    local ClickDetector = Instance.new("ClickDetector")
    ClickDetector.Parent = Player.Character
end

Player.Character.ClickDetector.MouseClick:Connect(function()
    Player.PlayerGui.ScreenGui.Enabled = false
Player.Character.Torso.BrickColor = BrickColor.new("Electric Blue")
end)
0
Electrib blue*** Jxonathan 0 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

You're setting ClickDetector in a Model. It should be set in a part for it to work.

Also instead of refering it again with Player.Character.ClickDetector when there's already a variable set for it. Just use the variable ClickDetector instead of Player.Character.ClickDetector.

Ad

Answer this question