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

Invalid argument #3 (string expected, got Instance)?

Asked by 3 years ago
game.ReplicatedStorage.ChangeCrate.OnServerEvent:Connect(function(plr,str)
    local stats = plr:WaitForChild("stats").CrateValue
    local String = str
    stats.Value = String
end)

Event^^ Apparently str is an Instance.

local plr = game.Players.LocalPlayer
event:FireServer(plr,"Large Crate")

What I fired ^^

1 answer

Log in to vote
3
Answered by
Raccoonyz 1092 Donator Moderation Voter
3 years ago

:FireServer() does not require a player instance as the first argument. However, since you provided it, the "str" variable is actually the player instance. This is because :FireServer() accepts a tuple of arguments,

To fix it, you can do this. event:FireServer("Large Crate")

Ad

Answer this question