Hello! I am trying to make a annoument system and I am having some issue.
Issue:
Workspace:
Code:
Local script
local valueputthough = script.Parent.Parent.Value.Value
script.Parent.MouseButton1Click:Connect(function(Player)
script.Parent.Parent.Value.Value = script.Parent.Parent.AddText.Text
wait(1)
game.ReplicatedStorage.EventsGUI.Message:FireServer(valueputthough)
end)
Server script:
game.ReplicatedStorage.EventsGUI.Message.OnServerEvent:Connect(function(Message)
script.Parent.Text = Message
script.Parent.Parent.Parent.Main.Visible = true
end)
Kaid3n22
(Kaiden)
January 18, 2022, 10:41pm
#2
ii_inforcelaw:
Message
the first parameter of a remote event is always the player.
game.ReplicatedStorage.EventsGUI.Message.OnServerEvent:Connect(function(player, Message)
PokeDB99
(PokeDB)
January 18, 2022, 10:42pm
#3
Try and use this.
game.ReplicatedStorage.EventsGUI.Message.OnServerEvent:Connect(function(player, Message)
script.Parent.Text = Message
script.Parent.Parent.Parent.Main.Visible = true
end)
PokeDB99
(PokeDB)
January 18, 2022, 10:42pm
#4
Give the solution to Kaiden if it is the solution because he replied first.
Kaid3n22
(Kaiden)
January 18, 2022, 10:47pm
#6
this is because you are referencing the value at the beginning of the script, so you should update it through this:
local valueputthough = script.Parent.Parent.Value
script.Parent.MouseButton1Click:Connect(function(Player)
script.Parent.Parent.Value.Value = script.Parent.Parent.AddText.Text
wait(1)
game.ReplicatedStorage.EventsGUI.Message:FireServer(valueputthough.Value)
end)
PokeDB99
(PokeDB)
January 18, 2022, 10:47pm
#7
Did you set valueputthough
to what you want it to be when you fire the event?
Thankyou for helping me with my problem!
sorry for asking this but it works the first time just good it sends the message and displays it but when you press the close button and then send another one it just does not work no errors or anything
PokeDB99
(PokeDB)
January 18, 2022, 11:05pm
#10
Are you changing the Value at all? If so then it should work.
Example: I say this in where you put the message: Hello all then it will show up thats fine ok then when they click ok and I do another saying: Bye all, it does not show up the gui
PokeDB99
(PokeDB)
January 18, 2022, 11:08pm
#12
That is because in the beginning you set the value so you have to change the value to get a different result.
It takes it out from what is said in the thing here I got an example: https://gyazo.com/2063e505120c0f6067339ef477af8efd
Kaid3n22
(Kaiden)
January 18, 2022, 11:12pm
#14
this is because you close the gui locally and not on the server side. So, when the GUI is trying to be turned visible on the server, the server views it as already open. So, either change the closing script to a server script or, add an extra line like this on the server part:
game.ReplicatedStorage.EventsGUI.Message.OnServerEvent:Connect(function(player, Message)
script.Parent.Text = Message
script.Parent.Parent.Parent.Main.Visible = false
script.Parent.Parent.Parent.Main.Visible = true
end)
PokeDB99
(PokeDB)
January 18, 2022, 11:14pm
#15
Wouldn’t you want to check if it is open or closed like this?
game.ReplicatedStorage.EventsGUI.Message.OnServerEvent:Connect(function(player, Message)
script.Parent.Text = Message
if script.Parent.Parent.Parent.Main.Visible == false then
script.Parent.Parent.Parent.Main.Visible = true
else
script.Parent.Parent.Parent.Main.Visible = false
end
end)
Thanks for making it work for me! Have a good day.
1 Like