i’m making a game where you get a random letter on the client and arent able to say it in chat and i want to make an overhead gui that shows the letter you cant say for other players on the server
im just gonna explain simply, i send a fireserver with the stringvalue.value (which is in replicatedstorage) from the client to the server which gets the stringvalue.value and puts it on the text on the overhead gui
ive done some printing and messing around and im 100% sure that the server thinks the stringvalue.value is the player (output said player name and stuff)
it also gives me an error to prove it more which says
Unable to assign property Value. string expected, got Instance
and of course, players are an instance
how do i fix this
It’s difficult to help you without seeing any of your code but when your using fireserver are you sending the player and then the stringvalue? fireserver automatically sends the player so you would only send the stringvalue:
MyRemote:FireServer(Player, StringValue) -- Wrong
MyRemote:FireServer(StringValue) -- Correct
1 Like
client
letterhead:FireServer(lettervalue.Value)
server
letterhead.OnServerEvent:Connect(function(lettervalue)
sorry for not showing the code by the way
heres the full client
local lettervalue = game:GetService("ReplicatedStorage").Letter
local letterhead = game:GetService("ReplicatedStorage").letterhead
repeat wait(2)
until lettervalue.Value ~= ""
print(game.Players.LocalPlayer.Name.." for client cant say "..lettervalue.Value)
wait(1)
letterhead:FireServer(lettervalue.Value)
and the server
local gui = game:GetService("ServerStorage").CantSay
local letterhead = game:GetService("ReplicatedStorage").letterhead
game:GetService("Players").PlayerAdded:Connect(function(player)
letterhead.OnServerEvent:Connect(function(lettervalue)
print(lettervalue)
local clonegui = gui:Clone()
clonegui.Parent = player.Character.Head
clonegui.Text.Text = "Can't say: "..lettervalue
print(player.Name.." for server cant say "..lettervalue)
end)
end)
error message also comes along at the clonegui.text.text part saying
ServerScriptService.Overhead:9: attempt to concatenate string with Instance
instance seeming to be the player
should be
letterhead.OnServerEvent:Connect(function(Player, lettervalue)
First parameter of OnServerEvent is the Player that fired it.
So really, you don’t need it wrapped inside the PlayerAdded call as you get the player from the ServerEvent anyway.
1 Like
alright, ill try that and give you an update
1 Like
lets goo it works! thank you so much
1 Like