How to make a gui that puts you on fire and only works one time in a life spam

If you want I can make a copy of the game and let you edit I don’t know why its not working

I don’t know why it’s not working on your side, but here’s the place I used:

FireHurts.rbxl (33.0 KB)

It works completely fine for me

Wait can’t u just edit my game because my pc is trash and it has no space well it does but you get what I mean

Can’t you just go in my game to see what’s wrong?

Game Id: 6830934252

I edited the thing I’m going to post the model can you see what’s wrong with tit maybe that other scripts? I have no idea

The place file is literally 33.0 KB, that’s a low amount for space…

I mean this script

local Button = script.Parent
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local HRP = Character:WaitForChild("HumanoidRootPart") --We want to parent this to the Character's Root
local Humanoid = Character:WaitForChild("Humanoid") --So that we can damage the Character

--Fire Settings--
local Duration = 10
local DPS = 5

local function CastFire() --Creating our function here to make our fire
    local Fire = Instance.new("Fire")
    Fire.Parent = HRP

    for Loop = 1, Duration do
        wait(1)
        Humanoid:TakeDamage(DPS)
    end

    Fire:Destroy() --Destroying it after the duration ends
end

Button.MouseButton1Down:Connect(CastFire)

Also I’m getting the error “Player is not a valid member of DataModel”

1 Like

local player = game:GetService(“Players”).LocalPlayer – get tje player
local RemoteEvent = game.ReplicatedStorage.Event – If u want the others to see the fire, put this in.
local db = false
script.Parent.MouseButton1Click:Connect(function()
if not db then
db = true – code only work if db is false, if u want cooldown, just add wait(seconds) and set db to false
end
end)

Server:
game.ReplicatedStorage.OnServerEvent:Connect(function(player)
local fire = Instance.new(“Fire”)
fire.Parent = player.Character.HumanoidRootPart
for i = 10, 0, -1 do – makes a decreasing health with for i loop
local Hum = player.Character.Humanoid
Hum.Health = Hum.Health - 10
end
end)
Tell me if there are any problems.

1 Like

Thank you,

Sorry for the inconvenience.

Thank you for helping @DarlinShot254.

No problem, the first code is localscript, put in the button gui, the second one is a script in serverscriptstorage, remember to add a remote event into ReplicatedStorage.

Alright thanks for informing me.