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

Stuck on what to do can't use script to edit a gui through fe?

Asked by
Prestory 1395 Moderation Voter
6 years ago
Edited 6 years ago

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!

2 answers

Log in to vote
0
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
6 years ago

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)

Ad
Log in to vote
1
Answered by
joeldes 201 Moderation Voter
6 years ago

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

0
What do you mean local name = "Joe Blow" they select the name? and that sets the name for them Prestory 1395 — 6y
0
do you mean replacing local name with NameStrng.Value = script.Parent.First.Text.."".." "..script.Parent.Last.Text Prestory 1395 — 6y
0
Yes, I suppose joeldes 201 — 6y

Answer this question