Hi developers,
So I am trying to make an event that will fire when I click a button, and all I am getting is my warn function popping up, and the event is not playing? How can I fix this, is there anyone out there that can help me with this problem; Alternatively, I want the script to spawn black parts infinitely when the event is fired, and its no doing that, so I know my warn function is working, and the rest of the script isn’t.
Here is the code and the error:
local button = script.Parent
local click = script.Parent.ClickEvent
local SS = game:GetService(“ServerStorage”)
local fire = SS.Events.Event1:WaitForChild(“Event1Fire”)
local value = SS.Events.Event1:WaitForChild(“Bool”)
click.MouseClick:connect(function()
value.Value = true
wait(1)
if value.Value == true then
fire:FireAllClients(fire)
if fire:FireAllClients(fire) then
print("Client has been fired!")
while true do
wait(1)
local function newPart()
local coolPart = Instance.new("Part")
coolPart.Name = "JohnnyIsHere"
coolPart.Parent = game.Workspace
coolPart.Color = BrickColor.new("Black")
coolPart.Position = Vector3.new(0, 10, 0)
end
end
else
warn("Client cound not be fired!")
end
end
wait(1)
value.Value = false
end)
Here is my explorer tab and error:
Error:
Explorer tab:
Thanks a lot people!
Have a great day!