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

Why is the server message not appearing?

I have a LocalScript inside a TextButton:

ocal playerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
	 
function leftClick()
	local n = playerGui.OrderGui.Naem.TBO.Text
	game.ReplicatedStorage.VanillaMilkshake:FireServer()
	 print("VanillaClick")
	 playerGui.OrderGui.CurrentOrder.Text = "Vanilla Milkshake by "..n
	
end 


script.Parent.MouseButton1Click:Connect(leftClick)

And a Script inside ServerScriptService:

local playerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local n = playerGui.OrderGui.Naem.TBO.Text

game.ReplicatedStorage.VanillaMilkshake.OnServerEvent:Connect(function()
	
		
	game.StarterGui:SetCore("ChatMakeSystemMessage",{
		Text = "A Vanilla Milkshake has been ordered by "..n

})

end)

Why does no server message appear in chat?

2 comments

0

I suppose you mean local and not ocal on line 1 in your LocalScript?

0

Yes, I just didn't copy-paste it correctly.

1 answer

✓ Accepted answer

SetCore() can only be called from LocalScripts, and you cannot use LocalPlayer in Server Scripts. Please accept this answer :D It helps both me and you out!

2 comments

1

And you can't use LocalPlayer in a Server Script either

0

Thanks, I didn't catch that.

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