ok, i must be missing something REALLY obvious but can’t seem to find it, its just a simple value changing thingy, it prints e but not changing the value
wait()
local Stone = script.Parent.Metal.Value
a = true
script.Parent.At.Break.Triggered:Connect(function(plr)
print("e")
--if a then
--a = false
Stone = Stone - 1
-- wait(1)
-- a = true
--end
end)
script.Parent.Metal.Changed:Connect(function(plr)
if Stone > 0 then
if Stone == 1 then
script.Parent.Parent.Thing.Transparency = 0.75
script.Parent.Parent.Thing2.Transparency = 0.75
script.Parent.Parent.Thing3.Transparency = 0.75
elseif Stone == 2 then
script.Parent.Parent.Thing.Transparency = 0.50
script.Parent.Parent.Thing2.Transparency = 0.50
script.Parent.Parent.Thing3.Transparency = 0.50
elseif Stone == 3 then
script.Parent.Parent.Thing.Transparency = 0.25
script.Parent.Parent.Thing2.Transparency = 0.25
script.Parent.Parent.Thing3.Transparency = 0.25
elseif Stone == 4 then
script.Parent.Parent.Thing.Transparency = 0
script.Parent.Parent.Thing2.Transparency = 0
script.Parent.Parent.Thing3.Transparency = 0
end
end
if Stone == 0 then
plr.Resources.Metalp.Value = plr.Resources.Metalp.Value + 1
script.Parent.At.Break:Destroy()
script.Parent.At.Collect:Destroy()
script.Parent:Destroy()
end
end)
local Stone = script.Parent.Metal.Value
a = true
script.Parent.At.Break.Triggered:Connect(function(plr)
print("e")
--if a then
--a = false
Stone = Stone - 1
-- wait(1)
-- a = true
--end
end)
To
local Stone = script.Parent.Metal
a = true
script.Parent.At.Break.Triggered:Connect(function(plr)
print("e")
--if a then
--a = false
Stone.Value -= 1
-- wait(1)
-- a = true
--end
end)
Edit: Because of the variable change, you’d have to change the if statements to use Stone.Value instead of Stone.
Edit 2: Here’s an example of it all:
task.wait() -- task.wait() > wait()
local Stone = script.Parent.Metal
local deb = true
script.Parent.At.Break.Triggered:Connect(function(plr)
if deb then
deb = false
Stone.Value -= 1
task.wait(1)
deb = true
end
end)
script.Parent.Metal.Changed:Connect(function(value)
if value > 0 then
local transparency = 1 - (value/4)
script.Parent.Parent.Thing.Transparency = transparency
script.Parent.Parent.Thing2.Transparency = transparency
script.Parent.Parent.Thing3.Transparency = transparency
elseif value == 0 then
-- .Changed doesn't pass the player who changed the value
-- you'd need another method for giving the player's stats
script.Parent:Destroy()
end
end)