What do you want to achieve? So Hare my problem, if i click Then My Animation Work (With +Value) But if player have “10 Value” and he “-All Value” then My animation not work, But if i back my “10 Value” My animation work again to more value
What is the issue? Include screenshots / videos if possible!
local players = game:GetService("Players")
local playerLocal = players.LocalPlayer
local leaderstats = playerLocal:WaitForChild("leaderstats")
local Value1 = leaderstats:WaitForChild("Coin")
local playerGui = playerLocal:WaitForChild("PlayerGui")
local screenGui = playerGui:WaitForChild("Text_Value")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ValuePopUpTemplate = ReplicatedStorage:WaitForChild("Gui_Coin")
local odlCoinValue = Value1.Value
Value1.Changed:Connect(function()
local CoinPopUp = ValuePopUpTemplate:Clone()
CoinPopUp.Parent = screenGui
local randomNum1 = math.random(3,8)/10
local randomNum2 = math.random(1,7)/10
local newCoinValue = Value1.Value
local value = newCoinValue - odlCoinValue
if value > 0 then
CoinPopUp.amount.Text = "+"..value
odlCoinValue = Value1.Value
Animation()
end
end)
am gas its problem with this
local odlCoinValue = Value1.Value
if yes i dont no how to fix, if no, well. I need help
What solutions have you tried so far?
I try see in youtobe this problem to, but i see nothing abount this
Why not just use a remote event and make a parameter the value, and make the client receive it? Also not sure but by the looks of it, it would also be safer to use the remote event.
I’m assuming you are referring to the wood being “-1” for that just add a check to see if the player’s active Wood.Value or whatever the name is isn’t going below 0 and if it does just return so it doesn’t get updated client side. If you could show that script I could assist you further since the one you supplied only works for coins.
script.Parent.ProximityPrompt.Triggered:Connect(function(plr)
local coinInstance = plr.leaderstats.Coin
if (coinInstance.Value - 1) >= 0 then
print("Calculation says we are clear to go")
coinInstance.Value -=1
else
print("Cannot since the value will be negative")
end
end)