-- in servergui local clickdetector = game.Workspace.Chest_n_1.ClickDetector clickdetector.MouseClick:Connect(function() game.Workspace.MyClickDetectorEvent:FireServer() end)

-- in remote event game.Workspace.MyClickDetectorEvent.OnServerEvent:Connect(function() Cash = math.random(1,3) if Cash ==1 then game.Players.LocalPlayer.leaderstats.Cash = game.Players.LocalPlayer.leaderstats.Cash + 101 end

if Cash==2 then
	game.Players.LocalPlayer.leaderstats.Cash = game.Players.LocalPlayer.leaderstats.Cash + 190
	end



if Cash==3 then
	game.Players.LocalPlayer.leaderstats.Cash = game.Players.LocalPlayer.leaderstats.Cash + 310
end

end)

3 comments

0

Can't use LocalPlayer on the server. Also use code blocks please.

0

Also put your RemoteEvents in Replicated Storage

0

You can place RemoteEvents somewhere that Server-sided and Client-sided scripts can access. ReplicatedStorage is one of them, and it's easy to locate.