So basically whats wrong is im making this name choosing gui and it has to be fe and ik you are meant to use localscripts to edit guis but if i was to use a local script to edit this gui then how could it be fe?
This is what happens ingame https://gyazo.com/c9e2afa16670b459b31b9416bdfaa91e This is what happens in studio https://gyazo.com/b24f20a9111561254cbad43a2691b728
this is my code
--ServerScript local remote = script.Parent:WaitForChild("NameRMT") remote.OnServerEvent:Connect(function(player) local NameStrng = player.Backpack:WaitForChild("NameSTRNG") NameStrng.Value = script.Parent.First.Text.."".." "..script.Parent.Last.Text player.Backpack:WaitForChild("Finished").Value = true player.Character.Head:WaitForChild("NameTag").Text.Text = NameStrng.Value end)
--LocalScript local player = game.Players.LocalPlayer local remote = script.Parent.Parent:WaitForChild("NameRMT") script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.NameRMT:FireServer() wait(0.5) script.Parent.Parent:Destroy() end)
Answers will be appreciated thanks!
I think you misunderstood joeldes's answer. He is basically telling you to get the text of the textboxes in the LocalScript and pass them to the server with the RemoteEvent.
--ServerScript local remote = script.Parent:WaitForChild("NameRMT") remote.OnServerEvent:Connect(function(player, first, last) local NameStrng = player.Backpack:WaitForChild("NameSTRNG") NameStrng.Value = first.."".." "..last player.Backpack:WaitForChild("Finished").Value = true player.Character.Head:WaitForChild("NameTag").Text.Text = NameStrng.Value end)
--LocalScript local player = game.Players.LocalPlayer local remote = script.Parent.Parent:WaitForChild("NameRMT") script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.NameRMT:FireServer(script.Parent.First.Text, script.Parent.Last.Text) wait(0.5) script.Parent.Parent:Destroy() end)
Part of you issue is that you are telling the server nothing!!!
When you fire the server you need to send the names that the player set over with it. Right now you are not doing this. Oooooof.
Here is how you fix this:
First on the server side you need to add some arguments to the ServerEvent... Make it look like this
remote.OnServerEvent:Connect(function(player, name) local NameStrng = player.Backpack:WaitForChild("NameSTRNG") NameStrng.Value = name player.Backpack:WaitForChild("Finished").Value = true player.Character.Head:WaitForChild("NameTag").Text.Text = NameStrng.Value end)
And on the local end you need to do this:
local name = "Joe Blow" script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.NameRMT:FireServer(name) wait(0.5) script.Parent.Parent:Destroy() end)
This worked for me. Try it out.
If you liked my answer you have my humble permission to upvote. (just kidding... do what you want!)
And also, for more Roblox answers you can follow me on Twitch and YouTube