Hi, I’m making a game. One part of my game is to be able to edit you own part. I know the reason why it’s not working(firing at the same time with other part), but I just don’t know how to solve it. I tried the Devforum, the developer hub, Youtube, and many other things. I still don’t know what I need to do.
I have 4 different scripts.
-- Main1
local EditMessage1 = game.ReplicatedStorage.EditMessage1
local MainParts = game.Workspace.MainParts
local PlayerGui = game.Players.LocalPlayer.PlayerGui
local function labels()
EditMessage1:FireServer("name1", script.Parent.Parent.GameName.Text)
EditMessage1:FireServer("description1", script.Parent.Parent.Description.Text)
end
PlayerGui:WaitForChild("EditingUi").EditGui.DoneButton.MouseButton1Click:Connect(function()
labels()
PlayerGui:WaitForChild("EditingUi").EditGui.Visible = false
end)
EditMessage1.OnClientEvent:Connect(function(type1_, message)
if type1_ == "name1" then
MainParts.Main1.SurfaceGui.GameNameLabel.Text = message
elseif type1_ == "description1" then
MainParts.Main1.SurfaceGui.GameDescriptionLabel.Text = message
end
end)
This script is supposed to change part one(main1) of the one you claim(You edit text)
-- Main2
local EditMessage2 = game.ReplicatedStorage.EditMessage2
local PlayerGui = game.Players.LocalPlayer.PlayerGui
local MainParts = game.Workspace.MainParts
local function labels()
EditMessage2:FireServer("name2", script.Parent.Parent.GameName.Text)
EditMessage2:FireServer("description2", script.Parent.Parent.Description.Text)
end
PlayerGui:WaitForChild("EditingUi").EditGui.DoneButton.MouseButton1Click:Connect(function()
labels()
PlayerGui:WaitForChild("EditingUi").EditGui.Visible = false
end)
EditMessage2.OnClientEvent:Connect(function(type2_, message)
if type2_ == "name2" then
MainParts.Main2.SurfaceGui.GameNameLabel.Text = message
elseif type2_ == "description2" then
MainParts.Main2.SurfaceGui.GameDescriptionLabel.Text = message
end
end)
Same as part one but different part.
--Server
local EditMessage1 = game:GetService("ReplicatedStorage").EditMessage1
EditMessage1.OnServerEvent:Connect(function(player, type1_, message)
EditMessage1:FireAllClients(type1_, game:GetService("Chat"):FilterStringForBroadcast(message, player)) --Send our message back to all clients.
end)
(This is a script for part1, but it is the same just with different remote event and type2_)
I would appreciate help, because this is supposed to be the main thing of the game which I cant figure out!
Also I have another problem that helps with my game: Click To Own Part Using Object Value