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:

local RemoteEvent = Instance.new('RemoteEvent')
RemoteEvent.Parent = game.ReplicatedStorage
RemoteEvent.Name = "Increase CB"

function Increase(player)
player.leaderstats['Crate Bux'].Value = player.leaderstats['Crate Bux'].Value + player.PlayerGui.MainGui.Buttons['CLICK for CRATE BUX'].amount.Value    
end
RemoteEvent.OnServerEvent:Connect(Increase)

localscript :

local Remote = game.ReplicatedStorage:FindFirstChild('Increase CB')
local player = game.Players.LocalPlayer
local Gui = player.PlayerGui
local amount = player.PlayerGui.MainGui.Buttons['CLICK for CRATE BUX'].amount   
local CrateBux = player.leaderstats['Crate Bux'] 
wait()
Gui.MainGui.Buttons['CLICK for CRATE BUX'].MouseButton1Click:Connect(function()      
Remote:FireServer()
end)
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