hello fellow devs, i have a VERY simple code, but it dosn’t seem to work. i tried printing, it works but it seems to skipped the line of code that is supposed to check if a leaderstat is 0, which it is, here is the code i am talking about
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local UIS = game:GetService('UserInputService')
local RS = game:GetService('ReplicatedStorage')
local tool = script.Parent
local pos
local part = game.ReplicatedStorage.Blocks.Wood:Clone()
part.CanCollide = false
local character = player.Character or player.CharacterAdded:Wait()
local We = game.ReplicatedStorage.Wood2
script.Parent.Name = ("Wood ["..player.Resources.Wood.Value.."]")
-- Surface Detection
local value = game.Players.LocalPlayer.Resources.Wood.Value
local newvalue = game.Players.LocalPlayer.Resources.Wood
newvalue.Changed:Connect(function()
script.Parent.Name = ("Wood ["..player.Resources.Wood.Value.."]")
if value <= 0 then
script.Parent:Destroy()
end
end)
there is more code but i doubt it is the problem