I am trying to use only one event for something in my game, so when I fire it to the server, i send the state (ON or OFF) and the player, like this
event:FireServer("ON", player)
and in the server script, I pick it up like this
event.OnServerEvent:Connect(function(state, player)
end)
I then tried printing state like this
print(state)
but it returned nil
here is my entire code
local:
local player = game.Players.LocalPlayer
local debounce = false
local character = player.Character
local root = character:WaitForChild("HumanoidRootPart")
local mouse = player:GetMouse()
local UIS = game:GetService("UserInputService")
local spell = false
local active = false
local event = game.ReplicatedStorage.AbilityEvents.EXCLUSIVE.Reboundus
player.Chatted:Connect(function(msg)
if string.find(msg:lower(),"reboundus") ~= nil and debounce == false and spell == false and player.Character.Humanoid.ragdoll.Value == false and not player.Character.Humanoid.PlatformStand and player.Character.Humanoid.Health > 0 and active == false then
spell = true
active = true
print("said reboundus, enabled")
if player:GetRankInGroup(11954854) >= 200 and player.Team.Name ~= "Visitors" then
local fade = player.PlayerGui.SPELLFLASH.Blue
local tween = game.TweenService:Create(fade, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In), {["BackgroundTransparency"] = 0})
local tween2 = game.TweenService:Create(fade, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In), {["BackgroundTransparency"] = 1})
event:FireServer("ON", player)
print("fired reboundus ON")
wait(2)
spell = false
end
end
end)
player.Chatted:Connect(function(msg)
if string.find(msg:lower(),"rebounda") ~= nil and debounce == false and spell == false and player.Character.Humanoid.ragdoll.Value == false and not player.Character.Humanoid.PlatformStand and player.Character.Humanoid.Health > 0 and active == true then
spell = true
active = true
print("said rebounda, disabled")
if player:GetRankInGroup(11954854) >= 200 and player.Team.Name ~= "Visitors" then
local fade = player.PlayerGui.SPELLFLASH.Blue
local tween = game.TweenService:Create(fade, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In), {["BackgroundTransparency"] = 0})
local tween2 = game.TweenService:Create(fade, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In), {["BackgroundTransparency"] = 1})
event:FireServer("OFF", player)
print("fired rebounda OFF")
wait(2)
spell = false
end
end
end)
server:
local event = game.ReplicatedStorage.AbilityEvents.EXCLUSIVE.Reboundus
event.OnServerEvent:Connect(function(state, player)
print(player.Name)
print("recieved reboundus")
print(state)
if state == "ON" then
print("reboundus fired on")
local val = Instance.new("BoolValue")
val.Name = "ReboundusActive"
val.Value = true
val.Parent = player.Character
print("added value")
game.ReplicatedStorage.Events.SpellFOV:FireClient(player)
elseif state == "OFF" then
print("reboundus fired off")
if player.Character:FindFirstChild("ReboundusActive") then
player.Character.ReboundusActive:Destroy()
game.ReplicatedStorage.Events.SpellFOV:FireClient(player)
print("reboundus value destroyed")
end
end
end)
on the print statements on the server, this prints:
![]()
I had the exact same issue if i tried FireServer(player, "ON")
