Here is code
wait (10) local dil = game.Players.LocalPlayer.Backpack.Stats.Dil.Value if dil == "ES" then GUI = game.ReplicatedStorage.SehireES else if dil == "EN" then GUI = game.ReplicatedStorage.SehireEN else GUI = game.ReplicatedStorage.Sehire end end Play = game.Players script.Parent.Touched:connect(function (hit) if hit.Parent and game.Players:FindFirstChild(hit.Parent.Name) then Play = game.Players[hit.Parent.Name] if Play:FindFirstChild("PlayerGui") and not Play.PlayerGui:FindFirstChild(GUI.Name) then GUI:Clone().Parent = Play.PlayerGui end end end)
it needs to work but this script is not working
game.Players.LocalPlayer can only be used within a local script.
I belive you are trying to run this in a server script.
Since you are working with GUI's, you can put a "Local Script" not "Script" in StarterGui folder seen in the explorer tab in studio.
Then paste your code in the local script.
You can only index LocalPlayer
if the script is a localscript
. On normal scripts, the server doesn't know what LocalPlayer
is, so it's impossible to access.