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

How do i make this script apply to all players and not just me?(SOLVED)

Asked by 5 years ago
Edited 5 years ago

So this script works, but since its only referencing my name, it only works for me. How would i make this script work for every player that joins? My main account on Roblox is Imaginevreything (Every purposely misspelled), so that makes the script ony work for me.

local function OnClick(player)



game.Workspace.imaginevreything.HAND.Transparency = 0



game.Workspace.imaginevreything.OK.Transparency = 1

wait(3)



game.Workspace.imaginevreything.HAND.Transparency = 1



game.Workspace.imaginevreything.OK.Transparency = 0







end

print("DONE HOZAY")



script.Parent.ClickDetector.MouseClick:connect(OnClick)

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

Since the ClickDetector returns the Player who clicked it you should do the following:

function onClick(player)
player.Character --<And so on>
-- "player" references the player who clicked the part

end
0
now you would be able to do things such as: player.Character.HAND.Transparency = 0 Aneither 20 — 5y
0
Didnt work Adenandpuppy 87 — 5y
0
If it did not print an error (which it shouldn't, as long as you add the things correct); make sure it is connected to the MouseClick event. script.Parent.ClickDetector.MouseClick:Connect(onClick) Aneither 20 — 5y
Ad

Answer this question