Hello, I am trying to call a remote event but it isn’t running, and I can’t figure out why. This is my code:
Remote Event Call:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Player = Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
function EnableScripts()
Char.LookAtMouse.Enabled = true
Char.Shoot.Enabled = true
Char.FlyScript.Enabled = true
Player.PlayerGui.Stats.PointsFolder.PointsLabel:WaitForChild("PointsGUIScript").Enabled = true
end
script.Parent.Activated:Connect(function()
script.Parent.Parent.Enabled = false
ReplicatedStorage.Values:WaitForChild("GameIsPlaying").Value = true
EnableScripts()
ReplicatedStorage.Events.Chickens:FireServer()
end)
Remote Event:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Chicken = ReplicatedStorage.Assets.Chicken
local Playing = ReplicatedStorage.Values.GameIsPlaying
function SpawnChicken()
local ChickenClone = ReplicatedStorage.Assets.Chicken:Clone()
ChickenClone.Parent = workspace
local SpinScriptClone = ReplicatedStorage.Assets.Scripts.Spin:Clone()
SpinScriptClone.Parent = ChickenClone
end
ReplicatedStorage.Events.Chickens.OnServerEvent:Connect(function()
while Playing.Value == true do
print("Loop Began")
task.wait(math.random(2.5, 4))
SpawnChicken()
print("Chicken Spawned")
end
end)
I tried printing, testing values, etc. I couldn’t get it to work.