I made a script that has a bunch of global's and I want to know if it is possible to get the player from a regular script because, my script works in a regular script only and doesn't in a local but, I am using local player, so Idk where to start.. Any help..?
You get the player when you use Event
s.
to get the player from the Touched
event, you do:
brick.Touched:Connect(function(limb) -- Touched returns the part that touched "brick" local player = game.Players:GetPlayerFromCharacter(limb.Parent) if player then player.Character:BreakJoints() -- kills character player.leaderstats.Points.Value = 1000 -- sets value to 1000 end end)
to get the player from a ClickDetector, do:
ClickDetector.MouseClick:Connect(function(player) -- MouseClick returns the player that clicked player.Character:BreakJoints() player.leaderstats.Points.Value = 1000 end)
note that the arguments can be named anything
Short answer: nope.
Long answer: Since normal scripts are made to act in the server,there is no way a script can get the local player. Only local scripts can do that because they are made to act in the client.