So for context im making a script that gives the player cash when hitting a part above a certain speed, i made it fire a RemoteEvent instead because i think that otherwise it would not be FE compatible but now i cant fire it because of the the error mentioned in the title. How do i fix this, and is the script FE compatible without the RemoteEvent?
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local plr = workspace[hit.Parent.Name] --Access character from workspace.
local player = game.Players:GetPlayerFromCharacter(plr) --Access (plr)
if player.Character:FindFirstChild("Humanoid").Sit == true and
player.Character:FindFirstChild("HumanoidRootPart").Velocity.Magnitude >= 100 then
game.ReplicatedStorage.SpeedCameraCash:FireServer()
end
end
end)
The event listener:
game.ReplicatedStorage.SpeedCameraCash.OnServerEvent:Connect(function(plr)
plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value + plr.Character.HumanoidRootPart.Velocity.Magnitude*5
end)

6 comments
You can simply move the script to a server script, it will work
What do you exactly mean by that? Since its not a Local Script and the functions of the event are set in ServerScriptService.
Show the event listener
I updaed the question, there it is
hey you know that the first script must be a local script and the second script must be a normal script
I did that and it still dosent work, its giving no errors tho