So i'm trying to send some text from the server side to the client side using remoteevents but i can't to get it working it gives me these errors.
Errors
11:49:59.278 - Unable to cast value to Object 11:49:59.278 - Stack Begin 11:49:59.279 - Script 'ServerScriptService.ChooseMap', Line 32 11:49:59.279 - Stack End 11:49:59.298 - Unable to cast value to Object 11:49:59.298 - Stack Begin 11:49:59.299 - Script 'ServerScriptService.GameScript', Line 46 - global Intermission 11:49:59.299 - Script 'ServerScriptService.GameScript', Line 223
Server Script
game.ReplicatedStorage.ServerRequest.Notification:FireClient("Testing Testing", "Testing2 Testin2")
Client Script
reg.Notification.OnClientEvent:connect(function(val, txt) local Noti = script.Parent.Notifications Noti.Visible = true Noti:TweenPosition(UDim2.new(0.5, -200, 0.9, 20)) Noti.Text = val Noti.Shadow.Text = val Noti.DownText.Text = txt Noti.ShadowDown.Text = txt wait(3) Noti:TweenPosition(UDim2.new(0.5, -200, 1, 20)) Noti.Visible = false end)
You're attempting to send information from the server to the client. So:
Server -> Client
When using a remote event that is being fired by a server-sided script, and then received by a client-side script you need to provide a player argument.
So, you would change your server-sided script to:
game.ReplicatedStorage.ServerRequest.Notification:FireClient(playerVariable, "Testing Testing", "Testing2 Testin2")
As you can see above I added a variable that's a player object called playerVariable. This variable must be a player object and can be set multiple ways. You can use events (PlayerAdded, PlayerRemoving, etc.) or you can just set it like this:
local playerVariable = game:GetService("Players"):WaitForChild("Player1") -- Player1 is only in studio of course
This is bad practice though and I don't recommend it.
Hope I helped.