Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

(?)script not working in game thats suppos to add but works in studio and gives no error ...---...

Asked by 6 years ago

I use remote events to connect the scripts

script:

1local RemoteEvent = Instance.new('RemoteEvent')
2RemoteEvent.Parent = game.ReplicatedStorage
3RemoteEvent.Name = "Increase CB"
4 
5function Increase(player)
6player.leaderstats['Crate Bux'].Value = player.leaderstats['Crate Bux'].Value + player.PlayerGui.MainGui.Buttons['CLICK for CRATE BUX'].amount.Value   
7end
8RemoteEvent.OnServerEvent:Connect(Increase)

localscript :

1local Remote = game.ReplicatedStorage:FindFirstChild('Increase CB')
2local player = game.Players.LocalPlayer
3local Gui = player.PlayerGui
4local amount = player.PlayerGui.MainGui.Buttons['CLICK for CRATE BUX'].amount  
5local CrateBux = player.leaderstats['Crate Bux']
6wait()
7Gui.MainGui.Buttons['CLICK for CRATE BUX'].MouseButton1Click:Connect(function()     
8Remote:FireServer()
9end)
0
You can't access objects in PlayerGui from the server unless the server placed it there. User#19524 175 — 6y
0
So, what do I do? thefatrat87 18 — 6y
0
find a solution around that...? radusavin366 617 — 6y
0
How... thefatrat87 18 — 6y

Answer this question