I have a script that towards the bottom says localplayer but i know a script cant use local player, so how would i find the name of the player that clicked the detector and use that instead of localplayer?
-- Variables --
local scriptFolder = script.Parent
local partFolder = script.Parent.Parent.PartsAndSound
-- Scripting --
partFolder.Enable.MainDetector.MouseClick:Connect(function()
partFolder.Enable.Printer:Play()
wait(0.1)
partFolder.Enable.MainDetector:Destroy()
scriptFolder.isPrinting.Value = true
wait(1)
scriptFolder.CP3M.Value = scriptFolder.CP3M.Value + 3000
wait(2)
partFolder.CashPrinted.SurfaceGui.CashPrinted2.Text = scriptFolder.CP3M.Value
partFolder.Enable.PrintedCash:Play()
wait(1)
scriptFolder.CP3M.Value = scriptFolder.CP3M.Value + 3000
wait(2)
partFolder.CashPrinted.SurfaceGui.CashPrinted2.Text = scriptFolder.CP3M.Value
partFolder.Enable.PrintedCash:Play()
wait(1)
scriptFolder.CP3M.Value = scriptFolder.CP3M.Value + 3000
wait(2)
partFolder.CashPrinted.SurfaceGui.CashPrinted2.Text = scriptFolder.CP3M.Value
partFolder.Enable.PrintedCash:Play()
wait(1)
scriptFolder.CP3M.Value = scriptFolder.CP3M.Value + 3000
wait(2)
partFolder.CashPrinted.SurfaceGui.CashPrinted2.Text = scriptFolder.CP3M.Value
partFolder.Enable.PrintedCash:Play()
partFolder.Enable.SecondaryDetector.MaxActivationDistance = 15
wait(1)
scriptFolder.CP3M.Value = scriptFolder.CP3M.Value + 3000
wait(2)
partFolder.CashPrinted.SurfaceGui.CashPrinted2.Text = scriptFolder.CP3M.Value
partFolder.Enable.PrintedCash:Play()
partFolder.Enable.SecondaryDetector.MaxActivationDistance = 15
if scriptFolder.CP3M.Value == 15000 then
partFolder.Enable.SecondaryDetector.MouseClick:Connect(function()
game.Players.(PLAYERNAME).leaderstats.Money.Value = game.Players.(PLAYERNAME).leaderstats.Money.Value + 15000
script.Parent.Parent:Destroy()
end)
end
end)

7 comments
so this gives me the name and how exactly would i be able to plug that into the script towards the bottom?
at the bottom instead of doing "game.Players.(PLAYERNAME)" you just do "player"
this is the bottom script its telling me that the player isnt a valid member of players: if scriptFolder.CP3M.Value == 15000 then partFolder.Enable.SecondaryDetector.MouseClick:Connect(function(player) -- giving the player parameter a name, in this case player local playerName = player.Name game.Players.players.leaderstats.Money.Value = game.Players.player.leaderst
i told you, you dont need to do game.Players.player, you just need to do 'player'
player.leaderstats.Money.Value = player.leaderstats.Money.Value + 15000
Ok so i re checked what u said, and i was being stupid and put it in the .players, i fixed it, thanks alot for helping me ive been stuck on this for a few hours! I can finally move on to other things in the game now.
Awesome, good luck on developing the game