I'm working with SurfaceGUIs and i have to use a script for the button function, and that means i'd need to find a way to acess a local player using a script.
SCRIPT:
repeat wait() until game.Players.LocalPlayer ~= nil local Player = game:GetService("Players").LocalPlayer --\PLAYER VALUES/-- local CORE = Player.PlayerGui:WaitForChild("Core") local Values = CORE:WaitForChild("Values") local PaymentValue = Values:WaitForChild("PaymentValue") local PaymentTime = Values:WaitForChild("PaymentTime") local Employeed = Values:WaitForChild("Employeed") --\TABEL VALUES/-- local Tabel = script.Parent.Parent local TabelValues = Tabel:WaitForChild("Values") local ShiftTime = TabelValues:WaitForChild("ShiftTime") local Payment = TabelValues:WaitForChild("Payment") script.Parent.MouseButton1Down:Connect(function() if Employeed.Value == false then Employeed.Value = true PaymentTime = ShiftTime PaymentValue = Payment end end)
I can explain the code in-case you wanna help.
Although you can't use LocalPlayer
in server scripts, many events pass it as a parameter. For example, PlayerAdded
's only parameter is the player who joined the game.
game:GetService("Players").PlayerAdded:Connect(function(player) print(player.Name) end)