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

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

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

✓ Accepted answer

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

3 comments

0

now you would be able to do things such as: player.Character.HAND.Transparency = 0

0

Didnt work

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)

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