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

Unable to cast value to object. Why?

Asked by 7 years ago

This issue is happening on the server script of a function that displays a message to another user, which therefore requires filtering. However when it gets to this line it throws out the error:

Unable to cast value to Object, Line 9

Script:

local onRecievingWarning = game.ReplicatedStorage.FilterWarning


onRecievingWarning.OnServerEvent:connect(function(player, message, victim)
    print("Triggered!")
    player = victim
    print(player)  --Used to make sure the I didn't mess up the order on the client side
    local filteredText = game:GetService("Chat"):FilterStringForBroadcast(player, message)
    local warngooey = game.ReplicatedStorage:WaitForChild("TPSWarnGUI"):Clone()
    warngooey.Enabled = true
    warngooey.LoginForm.Rsn.Text = filteredText
    warngooey.Parent = game.Players[player].PlayerGui
    wait(3)
    game.Players[player].PlayerGui.TPSWarnGUI:Destroy()
end)

0
i guess you could try without the wait for child abnotaddable 920 — 7y
0
You have mixed up the order for FilterStringForBroadcast, it needs the string message then the player. User#5423 17 — 7y
0
Still getting the error CondescendingReality 7 — 7y
0
Are you sending the player object on the client side? hiimgoodpack 2009 — 7y

Answer this question