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 7 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

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

Inside a GUI and localscript

1script.Parent.MouseButton1Click:connect(function(player)
2    game.Workspace.RemoteStats.ChangeStats:FireServer()
3end)
1
When you say StatFile.player, is there an actual object called player inside StatFile? cowsoncows 951 — 7y
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 — 7y
0
Is player in Level and Level1Value supposed to be the player who fired the remote? Xternl 7 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Try using this:

Localscript:

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

ServerScript

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

Answer this question