local repStorage = game:GetService("ReplicatedStorage")
local serverStorage = game:GetService("ServerStorage")
local purchaseAxe = repStorage.ToolEvents:WaitForChild("AxePurchased")
local purchasePickaxe = repStorage.ToolEvents:WaitForChild("PickaxePurchased")
local starterGUI = game:GetService("StarterGui")
local items = serverStorage.Items
local Axe = items.Axe
local Pickaxe = items.Pickaxe
local errorText = game.StarterGui.Shop.TextLabel
purchaseAxe.OnServerEvent:Connect(function(player)
local Gold = player.leaderstats.Gold
if Gold.Value >= 5 then
errorText.TextTransparency = 1
local purchase = true
Gold.Value = Gold.Value - 5
Axe:Clone().Parent = player.Backpack
else
errorText.TextTransparency = 0
end
end)
Thing is you can’t use starterGUI if your doing it to one player. You have to use PlayerGui otherwise it’ll never work in the end.
I dont know whoms to use tho which one
Use either one. Check which one works.
Mine should work though! However, try whichever you’d like first.
use the script i gave you above and format your script like ```
`
In this case, this would be the correct script:
local repStorage = game:GetService("ReplicatedStorage")
local serverStorage = game:GetService("ServerStorage")
local purchaseAxe = repStorage.ToolEvents:WaitForChild("AxePurchased")
local purchasePickaxe = repStorage.ToolEvents:WaitForChild("PickaxePurchased")
local items = serverStorage.Items
local Axe = items.Axe
local Pickaxe = items.Pickaxe
purchaseAxe.OnServerEvent:Connect(function(player)
local Gold = player.leaderstats.Gold
local PlayerGui = player:WaitForChild("PlayerGui") :: StarterGui
local errorText = PlayerGui:WaitForChild("Shop").TextLabel
if Gold.Value >= 5 then
errorText.TextTransparency = 1
local purchase = true
Gold.Value = Gold.Value - 5
Axe:Clone().Parent = player.Backpack
else
errorText.TextTransparency = 0
end
end)
What I posted earlier was wrong, I thought you were trying to this client sided at first. Make sure to use the PlayerGui
for changing something related to GUI, or it will not update locally and just update StarterGui
.
Well, you can format it with ease.
yeah i use local scripts inside the buttons where certain remotes are fired
Quick question why do you have two Colins on the same line as a script part?
That confuses me quite a bit currently.
thanks lolmans! so how would i tween this? so i can make it do stuff
If you need help with tweening, I suggest watching a tutorial on youtube or looking at the documentation for tweens. If that does not suffice, then you can create a separate scripting support topic.
I know that but is it like normal just using errotext and then just tweening it
You can tween the error text transparency by using TweenService:Create
to tween the TextTransparency
property to 1.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.