Hello, I am trying to make an RPG, and have completed my stats system, so now I am making forms, and for human, adrenaline. I am running into an issue, where when you press the key and fire the event, it reads the local value "on" as the players name, but I need it to be true or false for the script to activate the aura and give the stats.
EDIT: It reads every single value as the player, what is going on?
Code below.
This is the localscript that fires from client to server to do the stats and aura:
local plr = game.Players.LocalPlayer
local Player = game.Players:FindFirstChild(plr.Name)
repeat wait() until plr.Character
local character = plr.Character
local mouse = plr:GetMouse()
local on = false
mouse.KeyDown:connect(function(key)
if key == "g" then
if plr.ServerTraits.Statistics.Race.Value == "Human" then
if character.HumanoidRootPart.Adrenaline.Enabled == false then
on = false
end
if character.HumanoidRootPart.Adrenaline.Enabled == true then
on = true
end
wait()
game.ReplicatedStorage.FormEvents.Adrenaline:FireServer(Player, character, on)
else
return false
end
end
end)
This is the server script that receives the fired event: (The print(on) was how I found it read falsly.)
game.ReplicatedStorage.FormEvents.Adrenaline.OnServerEvent:Connect(function(Player, character, on)
print(on)
if on == false then
character.HumanoidRootPart.Adrenaline.Enabled = true
Player.ServerTraits.Statistics.Speed = Player.ServerTraits.Statistics.Speed + 100
Player.ServerTraits.Statistics.Stamina = Player.ServerTraits.Statistics.Stamina + 100
Player.ServerTraits.Statistics.Strength = Player.ServerTraits.Statistics.Strength + 200
Player.ServerTraits.Statistics.Tranquility = Player.ServerTraits.Statistics.Tranquility + 100
end
if on == true then
character.HumanoidRootPart.Adrenaline.Enabled = false
Player.ServerTraits.Statistics.Speed = Player.ServerTraits.Statistics.Speed - 100
Player.ServerTraits.Statistics.Stamina = Player.ServerTraits.Statistics.Stamina - 100
Player.ServerTraits.Statistics.Strength = Player.ServerTraits.Statistics.Strength - 200
Player.ServerTraits.Statistics.Tranquility = Player.ServerTraits.Statistics.Tranquility - 100
end
end)
