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

Userdata value is keep poping up from my output and this is only a word?

Asked by 4 years ago
game.ReplicatedStorage.CallWarn.OnServerEvent:Connect(function(a,p)
    local s = game.ServerStorage:WaitForChild("warning")
    local r = s:Clone()
    r.Parent = game.Workspace:WaitForChild(p).Head
    r.fg.Text = "Warning 1. Reason: "..a
    p.WarningCount = p.WarningCount + 1
    wait(5)
    r:Destroy()
end)

event run code:

game.ReplicatedStorage.CallWarn:FireServer("MissingBoshjio","res")
0
with remote events/functions your first parameter is always the player instance. So in the server event you should have something like... (player,a,p) as your parameters ForeverBrown 356 — 4y
0
it crashes script :P boshjio15854 15 — 4y
0
Can you post the error you are getting? ForeverBrown 356 — 4y
0
17:51:26.241 - ServerScriptService.Script:11: attempt to index field 'WarningCount' (a nil value) boshjio15854 15 — 4y
0
Not sure how that error relates to your title but, p is a string("res") and your trying to get something inside of a string(which can not be done.) Could you explain what you are trying to accomplish so we can help you understand? ForeverBrown 356 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

My comment is saying to do this..

game.ReplicatedStorage.CallWarn.OnServerEvent:Connect(function(player,a,p)
    local s = game.ServerStorage:WaitForChild("warning")
    local r = s:Clone()
    r.Parent = game.Workspace:WaitForChild(p).Head
    r.fg.Text = "Warning 1. Reason: "..a
    p.WarningCount = p.WarningCount + 1
    wait(5)
    r:Destroy()
end)

Then you could use the player parameter(and get its character) instead of referencing the workspace.

0
value is not working anyways boshjio15854 15 — 4y
Ad

Answer this question