Have you still used @DEVLocalPlayer script?
ru sure that
this path is right?
local Path = script.Parent.Parent.Parent.Parent.SurfaceGui.Frame.Container
Wait, am I still using âscript.Parent.MouseButton1Click:Connect(function()â?
Yes
adsfja;dfja;dfjfa;fja;osfija;ofjaes;ofia
Please be the solution
This error: âSurfaceGui is not a valid member of PlayerGuiâ, when I click it, it sends me towards the 2nd line.
script.Parent.MouseButton1Click:Connect(function()
local Path = script.Parent.Parent.Parent.Parent.SurfaceGui.Frame.Container -- make sure thats the right path
Path:ClearAllChildren()
end)
You donât have to iterate through a loop.
Roblox makes a special function to clear all instances named ClearAllChildren()
:
local container = script.Parent.Parent.Parent.Parent.SurfaceGui.Frame.Container
script.Parent.MouseButton1Click:Connect(function()
container:ClearAllChildren()
end)
I will check and see what it does.
what i meant is check if script.Parent.Parent.Parent.Parent.SurfaceGui
really leads to the SurfaceGui
I tried again, and I came up with this:
`script.Parent.Parent.Parent.Parent.SurfaceGui.Frame.Container:GetChildren()
hmm, iâm confused.
I will run the game again.
can you show me your explorer?
Took longer than expected:
The container is the one that is storing all the ImageLabels when a player paints on the whiteboard, and the localscript is the one that is trying to :GetChildren() in the container, so it can try and attempt to delete them all, when you click on the TextButton called âClearâ.
script.Parent.MouseButton1Click:Connect(function()
local container = script.Parent.Parent.Parent.Parent.SurfaceGui.Frame.Container
container:ClearAllChildren()
end)
Still encountering the same error:
âSurfaceGui is not a valid member of PlayerGuiâ
Itâs weirdâŚ
I will rename the SurfaceGui to something else; maybe itâs getting confused.
I will try again tomorrow, because even when I do:
game.Workspace["Ranks Only Smart Board"].WhiteBoard
it doesnât recognise anything else from there.
The PlayerGui is inside the Player, but I think the localscript is being replicated in there for the player (client-sided)
For some reason, it only works if I use âgame.Workspaceââ, instead of âscript.Parentââ. This is unless I try and use a RemoteEvent of course, but how would I go about doing that?
where is Draw
being moved to? what does CopyDraw do? with what the post above says, it seems as if this is being moved to somewhere else
If it doesnât work using the scriptâs directory, then the target instance probably hasnât been loaded yet.
Try this:
local container = script.Parent.Parent.Parent.Parent.SurfaceGui.Frame:WaitForChild("Container")
script.Parent.MouseButton1Click:Connect(function()
container:ClearAllChildren()
end)
Add extra WaitForChild()
s as needed.
Hope it helps!
This is what it looks like inside PlayerGui:
This is what the CopyDraw Script is:
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
local copy = script.Parent.Draw:Clone()
copy.Parent = player.PlayerGui --this is how the surfacegui called 'Draw', goes into the PlayerGui
copy.Adornee = script.Parent
if player:GetRankInGroup(7108062) >= 23 then
copy.Enabled = true
copy.BoardLoc.Value = script.Parent
copy.ImageButton.LocalScript.Disabled = false
else
copy.Enabled = false
copy.ImageButton.LocalScript.Disabled = true
end
for i,v in pairs(copy.Tools:GetChildren()) do
if v.Name == "CurrentDot" then
v.Dot.Change.Disabled = false
else
v.LocalScript.Disabled = false --reference to Clear button script
end
end
end)
end)
The script above me doesnât get copied into the player, and stays in the model. However, I have made it so only certain people who are rank 23 or above can use the board, so Iâve used an if statement and if the player is below that rank they canât see the clear button or anything (it doesnât get copied into the player). But, even when I can see it, the localscript inside the clear button doesnât work when I click it (unless I use âgame.Workspaceââ, but even that seems to be faulty).