So I'm currently making a script that when a bomb touches the ground, it explodes. The problem is that it works completely fine in ROBLOX Studio, but it doesn't work in the server. I've had this problem before but I'm not sure why it's doing it now. Could someone please help me with this? Thanks! NOTE: This script is inside a bomb that falls onto a platform called "Land" and it is cloned from ReplicatedStorage through a GUI in the player's GUI.
Link to what happens on serverside: https://gyazo.com/1b56efd869b4f0d53b5a9ea3e23f3928
Here's the script:
local BombTouching = false local beforeFinalService = { [1] = game:GetService('ServerStorage'), [2] = game:GetService('ReplicatedStorage') } local Nuke = beforeFinalService[2]:WaitForChild("Nuke") local Ring = beforeFinalService[2]:WaitForChild("Ring") script.Parent.Touched:connect(function(hit) if not BombTouching then print("Suh dude") BombTouching = true print("BombTouching = true") if hit.Name == "Land" then print("Hit the land") Nuke:Clone().Parent = game.workspace Ring:Clone().Parent = game.workspace print("Cloned Explosion") game.Lighting.Blur.Size = 36 game.Lighting.ColorCorrection.TintColor = Color3.new(255/255, 183/255, 0/255) game.Lighting.ColorCorrection.Brightness = 1 for i=1,0.6, -0.01 do wait(0.01) game.Lighting.ColorCorrection.Brightness = i end for i=36,14, -1 do wait(0.1) game.Lighting.Blur.Size = i end script.Parent:Remove() end BombTouching = false end end)
Script that clones the bomb into the workspace. This script is local and is in the Player's Gui.
local Bomb = game:GetService('ReplicatedStorage'):WaitForChild('Bomb') local Workspace = game:GetService('Workspace') local MainGUI = script.Parent function onClicked() function onClicked() local findBomb = Workspace:FindFirstChild("Bomb") local findNuke = Workspace:FindFirstChild("Nuke") if findBomb or findNuke then MainGUI.Text = "Already Bomb!" print("Already a bomb in the workspace!") wait(1) MainGUI.Text = "Nuke" Workspace.Bomb:WaitForChild('Script').Disabled = false else MainGUI.Text = "Working..." Workspace.Plane:Play() wait(10) Bomb:Clone().Parent = Workspace wait(6.5) Workspace.Explosion:Play() end end end MainGUI.MouseButton1Down:connect(onClicked)