Hello, I'm trying to make a property change gui to easily change some properties of a part for a part of teaching my friends how to script, by observing the properties of a part and changing them. Can anyone help me fix this issue? Thanks! I know this script may be messy, I'm sorry, but I just made this script and I'm not sure where the issue is, it's not outputted. Once again, thank you!:
PartPropertyHandler (ServerScriptService):
local allowed = {"ISkyLordDoge"} game.Players.PlayerAdded:Connect(function(player) for i, v in pairs(allowed) do if player.Name == v then script.SendProperties:Clone().Parent = player:WaitForChild("PlayerGui") end end end) game.ReplicatedStorage.ChangeProperties.OnServerEvent:Connect(function(player,BrickColorText,Material,Orientation,Position,Transparency) for i,v in pairs(allowed) do if player.Name == v then game.ReplicatedStorage.ChangeProperties:FireAllClients(BrickColorText,Material,Orientation,Position,Transparency) game.ReplicatedStorage.CanChange.Value = false wait(5) game.ReplicatedStorage.CanChange.Value = true end end end)
Local Script (In the GUI):
local frame = script.Parent.Frame local BrickColorText = frame.BrickColor.Text local Material = frame.Material.Text local Orientation = frame.Orientation.Text local Position = frame.PositionE.Text local Transparency = frame.TransparencyE.Text script.Parent.Parent:WaitForChild("Toggle").MouseButton1Click:Connect(function() if script.Parent.Visible == true then script.Parent.Visible = false else script.Parent.Visible = true end end) local db = true for i,property in pairs(script.Parent.Frame:GetChildren()) do if property.Changed then script.Parent.Submit.MouseButton1Click:Connect(function() if game.ReplicatedStorage.CanChange.Value == true and db == true then db = false game.ReplicatedStorage.ChangeProperties:FireServer(BrickColorText,Material,Orientation,Position,Transparency) else db = false script.Parent.Submit.Text = "Cannot send now" wait(2) db = true script.Parent.Submit.Text = "Send" end end) end end script.Parent.Cancel.MouseButton1Click:Connect(function() script.Parent.Visible = false end)
Local Script (In the part I'm trying to change the property of):
game.ReplicatedStorage.ChangeProperties.OnClientEvent:Connect(function(BrickColorText,Material,Orientation,Position,Transparency) local part = game.Workspace.PropertyPart part.BrickColor = BrickColor.new(tostring(BrickColorText)) part.Material = Enum.Material.Material part.Orientation = Vector3.new(Orientation) part.Position = Vector3.new(Position) part.Transparency = Transparency end)
-- Server Script local Replicated = game:GetService("ReplicatedStorage") local allowed = {"ISkyLordDoge"} local CanChange = Replicated.CanChange game.Players.PlayerAdded:Connect(function(player) for i, v in pairs(allowed) do if player.Name == v then script.SendProperties:Clone().Parent = player:WaitForChild("PlayerGui") end end end) Replicated.ChangeProperties.OnServerEvent:Connect(function(player,BrickColorText,Material,Orientation,Position,Transparency) for i,v in pairs(allowed) do if player.Name == v then Replicated.ChangeProperties:FireAllClients(BrickColorText,Material,Orientation,Position,Transparency) CanChange.Value = false wait(5) CanChange.Value = true end end end) -- LocalScript local Replicated = game:GetService("ReplicatedStorage") local frame = script.Parent.Frame local BrickColorText = frame.BrickColor local Material = frame.Material local Orientation = frame.Orientation local Position = frame.PositionE local Transparency = frame.TransparencyE local part = worksapce.PropertyPart script.Parent.Parent:WaitForChild("Toggle").MouseButton1Click:Connect(function() if script.Parent.Visible == true then script.Parent.Visible = false else script.Parent.Visible = true end end) local db = true for i,property in pairs(frame:GetChildren()) do script.Parent.Submit.MouseButton1Click:Connect(function() if Replicated.CanChange.Value == true and db == true then db = false Replicated.ChangeProperties:FireServer(BrickColorText.Text,Material.Text,Orientation.Text,Position.Text,Transparency.Text) else db = false script.Parent.Submit.Text = "Cannot send now" wait(2) db = true script.Parent.Submit.Text = "Send" end end) end script.Parent.Cancel.MouseButton1Click:Connect(function() script.Parent.Visible = false end) game.ReplicatedStorage.ChangeProperties.OnClientEvent:Connect(function(BrickColorText,Material,Orientation,Position,Transparency) part.BrickColor = BrickColor.new(tostring(BrickColorText)) part.Material = Enum.Material[Material] part.Orientation = Vector3.new(Orientation) part.Position = Vector3.new(Position) part.Transparency = Transparency end)