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

How do you make an e system with FE? (When you press e, you should blow up a vault)

I am working on a game, similar to Jailbreak, with no police. I am making a bank. You press "e" to blow up the vault. I'm not sure if I have to use a remote event or a remote function.

Here are the two scripts: 1 (Local Script)

local userInputService = game:GetService("UserInputService")
local bar = script.Parent.Bar3

game.ReplicatedStorage.EGuiEvents.EGui2.EnableEGui.OnClientEvent:Connect(function()
	if workspace.Vault.Base.CanCollide == true then
		script.Parent.Visible = true
	end
end)

userInputService.InputBegan:Connect(function(i, g)
	if script.Parent.Visible == true then
		if i.UserInputType == Enum.UserInputType.Keyboard then
			if i.KeyCode == Enum.KeyCode.E then
				if workspace.Vault.Base.CanCollide == true then
					bar:TweenSize(UDim2.new(0, 70,0, 5), "Out", "Linear", 5)
					wait(5)
					if bar.Size == UDim2.new(0, 70,0, 5) then
						bar.Size = UDim2.new(0, 1,0, 5)
						
						script.Parent.Visible = false
						
						local humanoid = workspace[game.Players.LocalPlayer.Name].Humanoid
						local anim = humanoid:LoadAnimation(script.Animovement)
						anim:Play()
						
						script:WaitForChild("Script").Disabled = false
						script:WaitForChild("Script").Parent = workspace.Bomb
						
						repeat wait(1) until workspace.RobberyInProg == false
						spawn(function()
							workspace.Bomb:WaitForChild("Script")
							
							workspace.Bomb.Script.Parent = script
							script:WaitForChild("Script")
							
							script.Script.Disabled = true
						end)
					end
				end
			end
		end
	end
end)

Script 2 (Sever Script)

player = game.Players:GetPlayerFromCharacter(workspace:FindFirstChild(player.Name))
if player then
	repeat wait(1) until script.Parent == workspace
	script.Parent.Bomb1.CanCollide = true
	script.Parent.Bomb1.Transparency = 0
	
	wait(3.2)
	
	script.Parent.Bomb2.CanCollide = true
	script.Parent.Bomb2.Transparency = 0
	
	wait(3.2)
	
	script.Parent.Bomb3.CanCollide = true
	script.Parent.Bomb3.Transparency = 0
	
	wait(4)
	
	script.Sound:Play()
	
	for i,v in pairs(script.Parent:GetChildren()) do
		if v:IsA("UnionOperation") then
			v.CanCollide = false
			v.Transparency = 1
		end
	end
	workspace.Vault.Base.Transparency = 1
	workspace.Vault.Base.CanCollide = false
	
	repeat
		wait()
	until workspace.RobberyInProg == false
	
	script.Parent = game.ReplicatedStorage
	
	workspace.Vault.Base.Transparency = 0
	workspace.Vault.Base.CanCollide = false
end

Any help?

2 answers

✓ Accepted answer

In this case it doesn't really matter which you use. What jailbreak does is fires the remote once you hold E for long enough.

Yes, it means that exploiters can bypass the hold down by firing your remote directly. The only way to fix that would be firing a remote when they press and release E, but that could lead to bugs.

The difference between Remote Events and Remote Functions is mainly that the Remote Event cannot tell the player / server depending on where the signal originated, to do anything afterwards.

If you used a Remote Function, you could have a Gui pop-up on the player's screen telling them the bank was destroyed (only the player that activated the sequence), but otherwise I would advise using a Remote Event.

Since you did not specify that anything was wrong with the script, I won't really delve into that unless you ask.

More information about Remote Functions / Events can be found here: https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events

1 comment

0

not really what I asked lol. I'll try to see and learn more, and thank you!

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