Hello, so basically I have a problem with a remote event not firing. The thing is the remote event fires in Roblox studio but not In Roblox probably because Roblox is 2x faster than Roblox studio. Because Roblox Studio is just a simulation of Roblox’s servers when playtesting.
Here is the script:
-- Player Service
local Players = nil
-- Main Stuff
local RemoteEvent = game.ReplicatedStorage.SideBar.GivePlayerToServer
local level = game.ReplicatedStorage:WaitForChild("GeneratedLevels"):GetChildren()
local studs = 0
local endLevel = game.ReplicatedStorage.End
-- Wait Time Variables
local WaitTime1 = os.time() + 2
local WaitTime2 = os.time() + 2
local ColorTable = {}
--repeat wait(1) until #game.Players:GetPlayers() <= 1
--repeat wait(1) until localplayer
wait(WaitTime1 - os.time())
while wait(1) do
wait()
local ColorTable = {}
local SizeTable = {}
for count = 1, 6 do
for i, placeHolder in pairs(game.Workspace.PlaceHolders:GetChildren()) do
local chosenLevel = level[math.random(1, #level)]:Clone()
print(chosenLevel.Name)
table.insert(SizeTable, UDim2.new(chosenLevel.SizeInfo.Size.Value,chosenLevel.SizeInfo.Size2.Value,chosenLevel.SizeInfo.Size3.Value,chosenLevel.SizeInfo.Size4.Value))
table.insert(ColorTable, Color3.new(chosenLevel.ColorBar.Value/250,chosenLevel.ColorBar2.Value/250,chosenLevel.ColorBar3.Value/250))
chosenLevel.PrimaryPart = chosenLevel.Floor
chosenLevel:SetPrimaryPartCFrame(CFrame.new(placeHolder.Position)+ Vector3.new(studs, 0, 0))
studs = studs - chosenLevel.studs.Value
chosenLevel.Parent = game.Workspace.currentLevels
end
end
local endLevelClone = endLevel:Clone()
endLevelClone.PrimaryPart = endLevelClone.Floor
endLevelClone:SetPrimaryPartCFrame(CFrame.new(game.Workspace.PlaceHolders.Floor.Position)+ Vector3.new(studs, 0, 0))
endLevelClone.Parent = game.Workspace.currentLevels
print("Be savage")
wait(WaitTime2 - os.time())
for _, player in ipairs(game:GetService("Players"):GetPlayers()) do
wait()
if (player) then
game.ReplicatedStorage:WaitForChild("SideBar"):WaitForChild("GiveColoursToClient"):FireClient(player, ColorTable, SizeTable)
end
end
local minutes = 6
local seconds = 0
local minutesVal = game.ReplicatedStorage:WaitForChild("TimerVal"):WaitForChild("minutesVal")
minutesVal.Value = minutes
local secondsVal = game.ReplicatedStorage:WaitForChild("TimerVal"):WaitForChild("secondsVal")
secondsVal.Value = seconds
local timer = game.ReplicatedStorage.Timer
repeat
if seconds <= 0 and secondsVal.Value <= 0 then
minutes = minutes - 1
seconds = 59
minutesVal.Value = minutesVal.Value - 1
secondsVal.Value = 59
else
seconds = seconds - 1
secondsVal.Value = secondsVal.Value - 1
end
if seconds <= 9 then
timer.Value = tostring(minutes)..":0"..tostring(seconds) else
timer.Value = tostring(minutes)..":"..tostring(seconds)
end
wait(game.Workspace.Values.WaitSpeed.Value)
until minutes <= 0 and seconds <= 0
if minutes <= 0 and seconds <= 0 then
-- Claimed Value
for _, player in ipairs(game:GetService("Players"):GetPlayers()) do
if (player) then
player.ClaimedFolder.Claimed.Value = false
end
end
-- Rep Values for local Buttons
game.ReplicatedStorage.ShopEvents.LocalButtons.invisibilityButton.Value = false
game.ReplicatedStorage.ShopEvents.LocalButtons.BunnyHopButton.Value = false
game.ReplicatedStorage.ShopEvents.LocalButtons.FogButton.Value = false
game.ReplicatedStorage.ShopEvents.LocalButtons.HighSpeedButton.Value = false
game.ReplicatedStorage.ShopEvents.LocalButtons.LowGravityButton.Value = false
game.ReplicatedStorage.ShopEvents.LocalButtons.invincibilityButton.Value = false
-- Bought Values
script.Parent.ShopItems.BunnyHopFolder.bought.Value = false
script.Parent.ShopItems.invisivilityFolder.bought.Value = false
script.Parent.ShopItems.FogFolder.bought.Value = false
script.Parent.ShopItems.LowGravityFolder.bought.Value = false
script.Parent.ShopItems.HighSpeedFolder.bought.Value = false
script.Parent.ShopItems.invincibilityFolder.bought.Value = false
-- Enabled Value example(BunnyHopEnabled)
script.Parent.ShopItems.BunnyHopFolder.BunnyHopEnabled.Value = false
script.Parent.ShopItems.invisivilityFolder.InvisibilityEnabled.Value = false
script.Parent.ShopItems.FogFolder.FogEnabled.Value = false
script.Parent.ShopItems.LowGravityFolder.LowGravityEnabled.Value = false
script.Parent.ShopItems.HighSpeedFolder.HighSpeedEnabled.Value = false
script.Parent.ShopItems.invincibilityFolder.invincibilityEnabled.Value = false
-- Fog Back to normal ;)
game.Lighting.FogEnd = 100000
game.Lighting.FogStart = 0
game.Lighting.OutdoorAmbient = Color3.fromRGB(128, 128, 128)
-- Gravity Back to normal ;)
game.Workspace.Gravity = 196.2
end
for i, player in pairs(game.Players:GetChildren())do
player:LoadCharacter()
wait(.1)
player:LoadCharacter()
end
game.Workspace.Values.WaitSpeed.Value = 1
game.Workspace.Values.SpeedMultiplier.Value = 1
game.Workspace.currentLevels:ClearAllChildren()
studs = 0
end
The remote event that is not getting fired is:‘game.ReplicatedStorage:WaitForChild(“SideBar”):WaitForChild(“GiveColoursToClient”):FireClient(player, ColorTable, SizeTable)’