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

Why won't my property change gui work?

Asked by 4 years ago

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):

01local allowed = {"ISkyLordDoge"}
02 
03game.Players.PlayerAdded:Connect(function(player)
04    for i, v in pairs(allowed) do
05        if player.Name == v then
06            script.SendProperties:Clone().Parent = player:WaitForChild("PlayerGui")
07        end
08    end
09end)
10 
11game.ReplicatedStorage.ChangeProperties.OnServerEvent:Connect(function(player,BrickColorText,Material,Orientation,Position,Transparency)
12    for i,v in pairs(allowed) do
13        if player.Name == v then
14            game.ReplicatedStorage.ChangeProperties:FireAllClients(BrickColorText,Material,Orientation,Position,Transparency)
15            game.ReplicatedStorage.CanChange.Value = false
16            wait(5)
17            game.ReplicatedStorage.CanChange.Value = true
18        end
19    end
20end)

Local Script (In the GUI):

01local frame = script.Parent.Frame
02local BrickColorText = frame.BrickColor.Text
03local Material = frame.Material.Text
04local Orientation = frame.Orientation.Text
05local Position = frame.PositionE.Text
06local Transparency = frame.TransparencyE.Text
07 
08 
09script.Parent.Parent:WaitForChild("Toggle").MouseButton1Click:Connect(function()
10    if script.Parent.Visible == true then
11        script.Parent.Visible = false
12    else
13        script.Parent.Visible = true
14    end
15end)
View all 37 lines...

Local Script (In the part I'm trying to change the property of):

1game.ReplicatedStorage.ChangeProperties.OnClientEvent:Connect(function(BrickColorText,Material,Orientation,Position,Transparency)
2    local part = game.Workspace.PropertyPart
3    part.BrickColor = BrickColor.new(tostring(BrickColorText))
4    part.Material = Enum.Material.Material
5    part.Orientation = Vector3.new(Orientation)
6    part.Position = Vector3.new(Position)
7    part.Transparency = Transparency
8end)
0
Why would you FireAllClients? Seems very useless Raccoonyz 1092 — 4y
0
i adapted that, but im not sure why it has a problem with EnumItem outputted: 20:59:35.409 - material1 is not a valid EnumItem 20:59:35.410 - Stack Begin 20:59:35.411 - Script 'Workspace.PropertyPart.Script', Line 4 20:59:35.412 - Stack End ISkyLordDoge 37 — 4y
0
tried switching to player gui rather than starter gui but still doesnt work :/ ISkyLordDoge 37 — 4y
0
What's the issue? Change line 4 to Enum.Material[Material] to fix the error above. ImTrev 344 — 4y
View all comments (9 more)
0
still doesn't work : / (sorry if i sound rude) ISkyLordDoge 37 — 4y
0
Also the server doesn't have access to PlayerGui. ImTrev 344 — 4y
0
i meant i changed player gui in the local script which was in the gui, btw the material variable is seen as '' (nothing, basically), by any chance, do you know the problem? thanks! ISkyLordDoge 37 — 4y
0
My Questions: 1. Can you see the GUI? 2. What happens when you press the Submit Button? 3. On line 19, is there a child object named "property"? ImTrev 344 — 4y
0
1: I can see the GUI. 2. When I press the submit button, it says 'Cannot Send'. 3. No. ISkyLordDoge 37 — 4y
0
What is the "Changed" after property because it's an event that fires when something is changed so it should connected to a function, and the "CanChange" value must be false because the debounce isn't. ImTrev 344 — 4y
0
I dont know how I didn't spot this before but you need to change the top variables without the .Text because it'll be blank since its taking the text when you first declared them. You need to add .Text to the ends of the parameters in your FireServer. ImTrev 344 — 4y
0
property's class is a TextBox and when it is changed i want to fire the server with parameters of the text which has been changed. also, where could I change the canChange value to false? ISkyLordDoge 37 — 4y
0
now it's just assuming 'Really red' as an enum value whilst its being classed for brickcolourtext which is not using enum ISkyLordDoge 37 — 4y

1 answer

Log in to vote
0
Answered by
ImTrev 344 Moderation Voter
4 years ago
Edited 4 years ago
01-- Server Script
02 
03local Replicated = game:GetService("ReplicatedStorage")
04 
05local allowed = {"ISkyLordDoge"}
06local CanChange = Replicated.CanChange
07 
08game.Players.PlayerAdded:Connect(function(player)
09    for i, v in pairs(allowed) do
10        if player.Name == v then
11            script.SendProperties:Clone().Parent = player:WaitForChild("PlayerGui")
12        end
13    end
14end)
15 
View all 76 lines...
0
Oh my lord! Thank you so much! You don't know how much this will help when it comes to teaching my friends scripting! ISkyLordDoge 37 — 4y
0
Happy to help! ImTrev 344 — 4y
0
How would I make it affect the whole server instead of just my client? Is it possible? Thanks! ISkyLordDoge 37 — 4y
0
Delete lines 17 to 19 and replace it with lines 71 to 75 and then delete 70 down. ImTrev 344 — 4y
Ad

Answer this question