local Spirit = script.Parent Spirit.Touched:connect(function(entity) if entity.Parent.Name == "FireEssence" and game.Players:FindFirstChild(entity.Parent.Parent.Name)then local debounce = true local Man = entity.Parent.Parent.Parent local RealMan = game.Players:FindFirstChild(entity.Parent.Parent.Name) local Bro = RealMan:FindFirstChild("leaderstats") local EXP = Bro:FindFirstChild("EXP") EXP.Value = EXP.Value + 10 print(EXP.Value) script.Parent.Transparency = 0.5 script.Parent.CanCollide = false wait(20) script.Parent.Transparency = 0 script.Parent.CanCollide = true end end)
Help please.
SuVee, Aspiring Developer.
RBXScriptSignal:connect()
with a lowercase C is deprecated, prefer RBXScriptSignal:Connect()
.
To get the player, you should use game.Players:GetPlayerFromCharacter()
.
Here's how a debounce would work:
local IsDebounced = false script.Parent.Touched:Connect(function(TouchedPart) if IsDebounced then return end IsDebounce = true print("Hi!") wait(10) IsDebounce = false end)
There is no point using Instance:FindFirstChild()
in your code if you are not going to check whether or not it returned nil
.