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

RemoteEvent is not doing anything?

Asked by 6 years ago

I have been struggling with this for a while now, looked around and found no answers. I'm new to this but could find nothing of any help after several hours.

Workspace: Script named RemoteStats, RemoteEvent called ChangeStats inside

Level = game.ServerStorage.StatFile.player.statnumbers.Level
LevelValue = game.ServerStorage.StatFile.player.statnumbers.Level.Value
script.ChangeStats.OnServerEvent:connect(function(player)
    Level.Value = Level.Value + 1
    print(LevelValue)
end)

Inside a GUI and localscript

script.Parent.MouseButton1Click:connect(function(player)
    game.Workspace.RemoteStats.ChangeStats:FireServer()
end)
1
When you say StatFile.player, is there an actual object called player inside StatFile? cowsoncows 951 — 6y
0
Yes, that is one of the problems. If I replace player with a specific name then that part works. But there is also something faulty with the rest of the script too RSYamamoto 2 — 6y
0
Is player in Level and Level1Value supposed to be the player who fired the remote? Xternl 7 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Try using this:

Localscript:

script.Parent.MouseButton1Click:connect(function()
    game.Workspace.RemoteStats.ChangeStats:FireServer(script.Parent.Text)
end)

ServerScript

Level = game.ServerStorage.StatFile.player.statnumbers.Level
LevelValue = game.ServerStorage.StatFile.player.statnumbers.Level.Value
script.ChangeStats.OnServerEvent:connect(function(player, text)
    Level.Value = Level.Value + 1
    print(LevelValue)
end)
Ad

Answer this question