Remotes not transferring variables

Ive been trying to make a speed spell that makes a global sound when you activate it, but for some reason it doesnt transfer the “spelltype” variable and the “player” variable, ive tried several ways to transfer these variables over to the script but it doesnt seem to work, can someone tell me why this happens and give me a possible fix?

LocalScript
 uis.InputBegan:Connect(function(input, IsTyping)
        	if IsTyping then return
        	elseif input.KeyCode == Enum.KeyCode.Q and castdebounce == false then
        		castdebounce = true
        		spelltype = "Speed"
        		wait()
        		rs:FireServer(spelltype, player)
        		local originalws = player.Character.Humanoid.WalkSpeed
        		player.Character.Humanoid.WalkSpeed = 27
        		wait(4)
        		player.Character.Humanoid.WalkSpeed = originalws
        		wait(10)
        		castdebounce = false
        	end
        end)
Script
local rs = script.Parent.rs

local function spell(spelltype, player)

print(player.Name)

if spelltype == "Speed" then

player.HumanoidRootPart.SpeedCast:Play()

end

end

rs.OnServerEvent:Connect(spell)

That’s because remote events take the player who fired it as the first argument.

Your function should be like this:

local function spell(player, spelltype)

thanks alot, i havent been using remotes for a while and totally forgot about that :flushed: