module script:
local module = {}
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local MapStorage = ReplicatedStorage.Map:GetChildren()
module.LoadMap = function()
local PickedMap = MapStorage[math.random(1, #MapStorage)]
PickedMap.Parent = game.Workspace
return PickedMap
end
module.Gamemode = function(Gamemode)
local point = 0
if Gamemode == "Classic" then
local PickedMap = module.LoadMap()
for _,player in ipairs(game.Players:GetPlayers()) do
point += 1
local hiddenleaderstats = player:FindFirstChild("hiddenleaderstats")
local character = player.Character
local Wrap = hiddenleaderstats.Wrap.Value
local Skin = hiddenleaderstats.Skin.Value
if game.ReplicatedStorage:WaitForChild("Karts"):WaitForChild("Wraps"):FindFirstChild(Skin):FindFirstChild(Wrap) then else warn("No skin/wrap for "..Skin.."/"..Wrap) end
local model = game.ReplicatedStorage:WaitForChild("Karts"):WaitForChild("Wraps"):FindFirstChild(Skin):FindFirstChild(Wrap):Clone()
model.Parent = workspace.Karts
model:SetPrimaryPartCFrame(PickedMap.KartSpawners:FindFirstChild(point).CFrame)
Remotes.Kart:FireClient(player,"Join",model)
end
Remotes.UI:FireAllClients("Countdown")
task.wait(4.8)
PickedMap.Barrier.CanCollide = false
end
end
return module
this is the module that fires the remote to the cilent, if i dont put a task.wait, the local script returns as “nil”, even with task.wait() it sometimes doesn’t work
local script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SoundService = game:GetService("SoundService")
local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local Remote = Remotes:WaitForChild("Kart")
local MainUI = script.Parent.MainUI
Remote.OnClientEvent:Connect(function(input, kart)
if input == "Join" then
kart.Remotes.Kart:FireServer("Join")
elseif input == "Leave" then
kart.Remotes.Kart:FireServer("Leave")
end
end)
if anyone could help that’d be extremely useful
and i don’t really why this happens, it fixes if i don’t clone