Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

i'm having issues with a remote event, can i have any help?

i'm trying to make a plugin for a car chassis, but i need to use a remoteevent to make an explosion so it can fully work (meaning it has to be fe).

how it works is it pretty much explodes your car and kills you if your car outputs over a certain amount of horsepower (to prevent people making their cars excessively fast), but i have to make it FE so the explosion properly works

these are the scripts

localscript that fires the remoteevent and does the other stuff that don't require fe

local gui = script.gui
local car = script.Parent.Car.Value
local players = game:GetService("Players")
local char = car.DriveSeat.SeatWeld.Part1.Parent
local player = players:GetPlayerFromCharacter(char)
local handler = car:FindFirstChild("Explode")

script.Parent.Values.Horsepower.Changed:connect(function()
	local hp = script.Parent.Values.Horsepower.Value
	
	if hp >= 300 then
		--
		gui:Clone().Parent = player.PlayerGui
		player.PlayerGui.gui.Enabled = true
		player.PlayerGui.gui.boom:Play()
		handler:FireServer()
		print("event active 1")
	wait(0)
	player.Character.Humanoid.Health = 0
		--
		
		--
	end
	
end)

script inside of the remoteevent that SHOULD be fired once the event is

local event = script.Parent
local seat = script.Parent.Parent.DriveSeat
local car = script.Parent.Parent

local function onEventFired()
	
	print("event active 2")
	
local explosion = Instance.new("Explosion")
explosion.BlastRadius = 1
explosion.BlastPressure = 50000
explosion.ExplosionType = Enum.ExplosionType.NoCraters
explosion.Position = seat.Position
explosion.Parent = seat
	
script.Parent.OnServerEvent:connect(onEventFired)

could i get any help with this? thanks! (print functions are to check, event active 1 is the only one that prints)

1 answer

Try removing the "--" in localscript

local gui = script.gui
local car = script.Parent.Car.Value
local players = game:GetService("Players")
local char = car.DriveSeat.SeatWeld.Part1.Parent
local player = players:GetPlayerFromCharacter(char)
local handler = car:FindFirstChild("Explode")

script.Parent.Values.Horsepower.Changed:connect(function()
    local hp = script.Parent.Values.Horsepower.Value

    if hp >= 300 then
        gui:Clone().Parent = player.PlayerGui
        player.PlayerGui.gui.Enabled = true
        player.PlayerGui.gui.boom:Play()
        handler:FireServer()
        print("event active 1")
    wait(0.1)
    player.Character.Humanoid.Health = 0
    end

end)

This discussion is preserved as it was. New answers, comments, and votes are closed.