I have a bomb in replicated storage, and a remote controller in starter pack. I have a local script in the remote controller. The local script clones the bomb and places the clone in front of me when I right click. That part works properly. The same script also will fire a remote event when I left click. I have a script in the bomb. The bomb should receive the remote event and explode, but it doesn't. Why doesn't the bomb receive the remote event?
local script in the remote controller:
player = game.Players.LocalPlayer mouse = player:GetMouse() explosionEvent = game.ReplicatedStorage.explosionEvent player.Backpack.Remote.Equipped:Connect(function() mouse.Button1Down:Connect(function() if player.character.Remote then player.Character.Remote.sphere.BrickColor = BrickColor.new("Bright green") player.Character.Remote.sphere.Beep:Play() wait(.5) explosionEvent:FireServer() player.Character.Remote.sphere.BrickColor = BrickColor.new("Bright red") end end) mouse.Button2Down:Connect(function() if player.character.Remote then newPart = game.ReplicatedStorage.bomb:Clone() newPart.Parent = game.Workspace newPart.playersName.Value = game.Players.LocalPlayer.Name playerCframe = game.Players.LocalPlayer.Character.UpperTorso.CFrame playerLv = playerCframe.lookVector newPart.bomb.CFrame = playerCframe + (playerLv * Vector3.new(5,5,5)) end end) end)
script in the bomb:
explosionEvent = game.ReplicatedStorage.explosionEvent explosionEvent.OnServerEvent:Connect(function(player) if player.Name == script.Parent.playersName then print("AAAAAA") end end)
I created the bomb on a local script, so it did not exist in the server. I had to have the bomb created in the server.