-
Each tool has the same number, and if you have the correct number, I want it to proceed.
-
The creating of the children are though a LocalScript, whereas the Script in the topic is in Workspace
If you have anymore questions, just ask.
Each tool has the same number, and if you have the correct number, I want it to proceed.
The creating of the children are though a LocalScript, whereas the Script in the topic is in Workspace
If you have anymore questions, just ask.
I donât know what you mean by this
whatâs the point of checking the toolâs number if theyâre all the same?
what do you mean by âhave the correct numberâ? what is having a number in this context?
what do the children have to do with this?
If you donât have the right number, which is a NumberValue inside the tool, then it shouldnât work. The script doesnât check the tool itself, it checks for the right number inside of it.
The player must have the right tool, to be able to have the correct corresponding number in it. Otherwise, the player shouldnât be able to edit the whiteboard.
All the numbers are the same, but not every player is given a tool, only certain ranks get given one. If the player meets all these requirements, they can add children or paint to the whiteboard, etc.
Currently, it is always turning white now regardless. However, it should turn black, when there are no children, but it doesnât for some reason. Even though the RemoteEvent is fired;
LocalScript:
--Variables
local RemoteEvent = script.Parent.RemoteEvent
local BoardScreen = script.Parent.SurfaceGui.Frame -- Screen of the board
local OFF = Color3.fromRGB(47, 47, 47)
function CopyEnabledTrue()
if #BoardScreen.Container:GetChildren() == 0 then
BoardScreen.BackgroundColor3 = OFF --turns black if statement runs
end
end
RemoteEvent.OnClientEvent:Connect(CopyEnabledTrue)
Script:
--Variables
local perms = false
local debounce = false
local Whiteboard = script.Parent
local BoardScreen = Whiteboard.SurfaceGui.Frame
local ScreenLabel = BoardScreen.ScreenLabel
Whiteboard.Touched:Connect(function(marker)
if marker ~= nil and marker.Parent ~= nil and marker.Parent:FindFirstChild("CardNumber") ~= nil and marker.Parent.CardNumber.Value == 55 then
if not debounce then
debounce = true
if perms then
copy.Enabled = false
copy.ImageButton.LocalScript.Disabled = false
task.wait(1)
local RemoteEvent = script.Parent.RemoteEvent
RemoteEvent:FireAllClients() --Do I put something in here, and should this be in .Touch or .TouchEnded?
else
copy.Enabled = true
copy.ImageButton.LocalScript.Disabled = false
end
end
debounce = false
end
end)
local ON = Color3.fromRGB(255, 255, 255)
local OFF = Color3.fromRGB(47, 47, 47)
Whiteboard.TouchEnded:Connect(function()
if copy.Enabled == false then
task.wait(1)
perms = false
elseif copy.Enabled == true then
BoardScreen.BackgroundColor3 = ON
ScreenLabel.TextTransparency = 0
task.wait(2)
ScreenLabel.TextTransparency = 1
perms = true
end
end)
RemoteEvent
is fired, in .Touch
or .TouchEnded
or not?:FireAllClients()
brackets?Edit: Is there an easier way of doing this since it does not work. Using a BoolValue, toggled when a child is created through the LocalScript, which creates them maybe? Or something else?
Did you check the children from the server
? Since this is a touched event it must
run on the server meaning any client
changes will not
have any
effects.
Yes, but since the ImageLabels were being created in a LocalScript
they couldnât see them and so I had changed them to a LocalScript
.
As you said, it is quite hard since .Touch
only works in a Script when you detect when the part is touched, but the checking of the ImageLabels can only be done on the client
in this case.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.