Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

5 comments

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

0

it crashes script :P

0

Can you post the error you are getting?

0

17:51:26.241 - ServerScriptService.Script:11: attempt to index field 'WarningCount' (a nil value)

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?

1 answer

✓ Accepted answer

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.

1 comment

0

value is not working anyways

This discussion is preserved as it was. New answers, comments, and votes are closed.