Okay, so I'm making a "real life simulator" game. And I want the toaster to do more damage the hotter it gets.
So I have 2 scripts, one is damage, the other is adding to damage.
This one is for the damage itself when touched:
Damage = script.Parent:WaitForChild("Damage").Value script.Parent.Touched:connect(function(hit) if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then local Humanoid = hit.Parent:WaitForChild("Humanoid") hit.Parent.Humanoid.Health = Humanoid.Health - Damage end end)
And here's the one to add to the Damage Value: (It's inside of the value)
Value = script.Parent.Value while true do script.Parent.Value = Value + 5 wait(1) end
The damage does -5, but I don't know why the value isn't going up.
I'm new to using values like this.
local Damage = script.Parent.Damage.Value script.Parent.Touched:connect(function(hit) if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then local Humanoid = hit.Parent:FindFirstChild("Humanoid") hit.Parent.Humanoid:TakeDamage(Damage) end end)
WaitForChild means the script waits until an Instance like Humanoid is added, FindFirstChild finds the first child named a specific name.
local Value = script.Parent.Value while wait(1) do script.Parent.Value = Value + 5 end
Nothing wrong here.
I dunno if this works or not.