Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

RemoteEvent FireServer isn't working or showing up on all screens. May I get help?

Asked by 6 years ago
Edited 6 years ago

FILTERING ENABLED IS ON

ServerScript in Workspace:

local remote = game.ReplicatedStorage.Give

remote.OnServerEvent:Connect(function(Player)
    game.Players.LocalPlayer.leaderstats.Cash.Value = game.Players.LocalPlayer.leaderstats.Cash.Value +1
end)

LocalScript in StarterGui:

local remote = game.ReplicatedStorage.Give

game.Players.LocalPlayer:GetMouse().Button1Down:Connect(function()
    remote:FireServer(1)
end)

In output it says "21:58:54.737 - exception while signaling: InsertService cannot be used to load assets from the client" I have no clue what that means. My cash on the leaderboard always stays as 0 when I click too. How do I fix this?

0
is there more to the script? post the full one if so hellmatic 1523 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

In the ServerScript, you are asking for game.Players.LocalPlayer, but the LocalPlayer can only be accessed from LocalScripts (Hence Local Local Localllssss). Also, A RemoteEvent always passes the Player as the first argument so you probably don't want to put (1) on the Client-side.

Server Script:

local remote = game.ReplicatedStorage.Give

remote.OnServerEvent:Connect(function(Player)
    Plr = (Stuff for finding the player's leaderstats but I am rushed for time lol) 
    if Plr then 
        Plr.leaderstats.Cash.Value = Plr.leaderstats.Cash.Value + 1
    end
end)

Local:

local remote = game.ReplicatedStorage.Give

game.Players.LocalPlayer:GetMouse().Button1Down:Connect(function()   
        remote:FireServer() -- No "1" because we don't have an argument for it on the server side.
end)

Hope I could point you in the right direction!

Ad

Answer this question