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

RemoteEvent error help?

Asked by
NotSoNorm 777 Moderation Voter
8 years ago

I keep getting OnServerInvoke is not a valid member of RemoteEevent

Invoke server script

while true do
    wait(60)
    mainmod:Appear()
    mainmod:Spin(5)
    game.Workspace.DataStore.StoreData:InvokeClient(script.Parent.Parent.Parent.Name, script.Parent.Parent.MoneyDisplay.Money.TextLabel.Text)
    mainmod:Dissapear()
end

Reciver

script.StoreData.OnServerInvoke(function(player, amount)
    MoneyStore:SetAsync("Money_"..player, amount)
end)
0
Is the local script in workspace?! EzraNehemiah_TF2 3552 — 8y
0
The local script is in playergui NotSoNorm 777 — 8y
0
You have the player name, not the player itself. Also is script.Parent.Parent.Parent etc the character or the player? EzraNehemiah_TF2 3552 — 8y
0
I got the name of the player NotSoNorm 777 — 8y

2 answers

Log in to vote
1
Answered by
SFOH 15
8 years ago

Use OnServerInvoke as an event

script.StoreData.OnServerEvent:connect(function(player, amount)
    MoneyStore:SetAsync("Money_"..player, amount)
end)

edit - changed to OnServerEvent

0
same error NotSoNorm 777 — 8y
0
Mistook that for a RemoteFunction. You want OnServerEvent instead of OnServerInvoke SFOH 15 — 8y
0
now there is no error but nothing is happening :< NotSoNorm 777 — 8y
0
It should be ("Money_"..player.Name, amount) drahsid5 250 — 8y
0
you should be using userid if you want their stats to save if they change their name, bruh unmiss 337 — 8y
Ad
Log in to vote
1
Answered by 8 years ago

Do what @SFOH said to do, use OnServerEvent instead of OnServerInvoke, also, you forgot the "connect" part or your code. But there is another error in your first script, If you're invoking a local script you need the first argument to be the PLAYER. Not the Player's NAME.


Final Product

Reciver

script.StoreData.OnServerEvent:connect(function(amount)
    MoneyStore:SetAsync("Money_"..game:GetService("Players").LocalPlayer, amount)
end)

ServerScript

while wait(60) do
    mainmod:Appear()
    mainmod:Spin(5)
    game.Workspace.DataStore.StoreData:InvokeClient(game:GetService("Players"):GetPlayerFromCharacter(script.Parent.Parent.Parent), script.Parent.Parent.MoneyDisplay.Money.TextLabel.Text)
    mainmod:Dissapear()
end

Hope it helps!

0
View source, I have the player in there also I have tested it and doesn't work :< NotSoNorm 777 — 8y
0
@NotSoNorm on line 2 of the first script, he still needs to add LocalPlayer.Name HungryJaffer 1246 — 8y
0
@HungryJaffer, It still works either way. EzraNehemiah_TF2 3552 — 8y

Answer this question