I am trying to make a trigger block to activate an explosion script on some other block. I have this block called parter, and there is this trigger script inside him:
local BindableEvent = game.Workspace:WaitForChild("BindableEvent")
local part = script.Parent
part.Touched.Connect()
BindableEvent:Fire()
And I have this block called Partner and this script inside him + event:
local BindableEvent = game.Workspace.Partner:WaitForChild("BindableEvent")
BindableEvent.Event:Connect(function))
local.explosionPart = script.Parent local.explosion = Instance.new("Explosion", game.Workspace) explosion.Position = explosionPart.Position explosionPart:Destroy() end
But It's still not working, help
It's because you're using the wrong way to use events. First you've done :Connect(), when you have to use :Connect(function(), the second was that instead of doing (function(), you do (function)). Also, for the remote event, it's not .Event, it's .OnServerEvent for normal scripts and .OnClientEvent for local scripts. And the last problem is you used :Fire(), but it's :FireServer() for localscripts and :FireClient() from normal scripts. So here is the fixed script:
local BindableEvent = game.Workspace:WaitForChild("BindableEvent") local part = script.Parent part.Touched:Connect(function() BindableEvent:FireServer() end)
Other script:
local BindableEvent = game.Workspace.Partner:WaitForChild("BindableEvent") BindableEvent.OnServerEvent:Connect(function() -- code here end)
I hope this helped you!