Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LOCAL SCRIPT IN PLAYERUI SCREEN GUI <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- local Player = game.Players.LocalPlayer
- local BagText = script.Parent.BagLabel
- local CoinText = script.Parent.CoinLabel
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local RemoteEvents = ReplicatedStorage.RemoteEvents
- BagText.Text = "Bag: " .. Player.PlayerStats.CurrentValue.Value .. "/" .. Player.PlayerStats.Storage.Value
- CoinText.Text = "Coins: " .. Player.PlayerStats.Coins.Value
- Player.PlayerStats.CurrentValue:GetPropertyChangedSignal("Value"):Connect(function()
- BagText.Text = "Bag: " .. Player.PlayerStats.CurrentValue.Value .. "/" .. Player.PlayerStats.Storage.Value
- end)
- Player.PlayerStats.Coins:GetPropertyChangedSignal("Value"):Connect(function()
- CoinText.Text = "Coins: " .. Player.PlayerStats.Coins.Value
- end)
- REGULAR SCRIPT IN SERVERSCRIPTSERVICE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local RemoteEvents = ReplicatedStorage.RemoteEvents
- local CoinClicked = RemoteEvents.CoinClicked
- CoinClicked.OnServerEvent:Connect(function(player, Strength)
- if player.PlayerStats.CurrentValue.Value < player.PlayerStats.Storage.Value then
- player:WaitForChild("PlayerStats").CurrentValue.Value = player.PlayerStats.CurrentValue.Value + Strength
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement