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

How to make a GUI that puts you on fire and it only works once in a life spam I’ve tried but I’m trash at scripting please help me

If you can create a Modal it will be greatly appreciated.

1 Like

I just want it so you can tap it and done it puts you on fire

I mean you could just simply detect whenever a GuiButton gets hit using the MouseButton1Down Event, which fires whenever a button gets interacted with by a player

Supposedly the most simplest thing, is to create a Fire Object that slowly damages the player upon clicked on, and we can set a custom duration, & damage for how deadly we want to make this Fire :thinking:

GuiButtons should be in LocalScripts as well, since they’re capable of accessing client detection

local Button = scipt.Parent
local Player = game.Player.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)

Handling damage on client is not always the best idea, I recommend you use a RemoteEvent | Roblox Creator Documentation

I mainly just gave a simple example as to how you could implement it, if there are multiple players then yes you’d need to use RemoteEvents which handle client/server transportation

@Jackscarlett It’s not working for me I’m most likely stupid and have no idea what mistake I made

Could we see how your Explorer is organized? The LocalScript should be parented inside the Gui Button

Wait can you have a look at this?

Can you see what’s wrong? (3) THE THING - Roblox

@Jackscarlett

@JackscarIitt This is the id of the thing 6830818621

I’m very new to this pls tell me what’s wrong the model id is 6830818621 pls help me.

Oh I’m dumb I forgot the script

Ok try this

local Button = script.Parent
local Player = game.Player.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)
1 Like

Can you look at the model it’s not working 6830858732

@Jackscarlett It wont even work if I remove the thing I don’t know what’s wrong with it

I hate my typos

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 @JackscarIitt
I’m just asking if I edit DPS Will it lower the amount of damage it does

Depending if you want to decrease/increase it, then yes

The DPS variable would be valid for the Humanoid:TakeDamage() function, since it’s a number value being passed

1 Like

Yah so what can I do to make it work for my game

What do you mean? You can adjust the --Fire Settings-- properties or decrease the rate inside the loop

The thing isn’t working in my game I don’t get why The model 6830858732

Are you sure you’re using the recent script I just sent to you?

You can join this game to see if it works Game Id:6713916924