For example,
UserInput.InputBegan:connect(function(input,gpe)
if not gpe and input.KeyCode == Enum.KeyCode.F and enabled == false then
enabled = true
the
enabled = true
allows me to make it so the element cannon't be spammed as I can change it to false when the element has fired from the player.
However, in FE since the scripts are not together but client-server script how would I make this work as I used parts of UIS to make this work, but because the script isn't one big script, how would i make the non spam-able be able to work?
I've already tried if statements in the server script but it doesn't seem to change anything.
FE
client
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local RemoteEvent = game.Workspace.Fired
local UserInput = game:GetService("UserInputService")
local Debounce = false
local Player = script.Parent.Parent
local stopDelay = 1
local enabled = false
UserInput.InputBegan:connect(function(input,gpe)
if not gpe and input.KeyCode == Enum.KeyCode.F then
if Debounce == true then return end
RemoteEvent:FireServer(Debounce)
wait(stopDelay)
end
end)
FE Server
local Player = script.Parent.Parent
game.Workspace.Fired.OnServerEvent:Connect(function(Player, Debounce)
--local Player = game.Players.LocalPlayer
--local AlreadyTouched = false
local Character = Player.Character or Player.CharacterAdded:wait()
Debounce = true
game:GetService("Chat"):Chat(Player.Character.Head, "Fire: Golden Blaze")
--local enabled = true
--local Player = script.Parent.Parent
local x = Instance.new("Part")
x.BrickColor = BrickColor.new("Gold")
x.Size = Vector3.new(5, 5, 5)
x.TopSurface = "Smooth"
x.BottomSurface = "Smooth"
x.Shape = "Ball"
x.Name = Player.Name
x.CanCollide = false
x.Transparency = 0
x.Material = "Neon"
local fd = script.Damage:clone()
fd.Parent = x
y = Instance.new("BodyVelocity")
y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
y.velocity = Player.Character.HumanoidRootPart.CFrame.lookVector*80
x.Parent = workspace
y.Parent = x
local f = Instance.new("Fire", x)
f.Color = Color3.new (255,55,0)
f.Size = 2
f.Heat = 50
x.CFrame = Player.Character.HumanoidRootPart.CFrame*CFrame.new(0, 0, -12)
fd.Disabled = false
game.Debris:AddItem(x, 6)
--game.Soundscape.blaster:Play()
wait(0.25)
wait(2)
Debounce = false
--enabled = false
print "ended"
end)

2 comments
On line seven the second argument of Instance.new is deprecated. Parent the BoolValue after setting all its properties.
Good to know, sucks that it is deprecated though.