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.
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.
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
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
Could we see how your Explorer is organized? The LocalScript
should be parented inside the Gui Button
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)
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)
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
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