Bindable Event not firing?

For some reason my bindable event is not firing, its able to find it but not fire. I’m not sure what to do here.

Humanoid.Died:Connect(function()
	wait(3.8)
	local Character = localplayer.Character or localplayer.CharacterAdded:Wait()
	print('Moved Position') -- for Debugging
	localplayer.hiddenstats.Spectator.Value = true
	bindableEvent:Fire(localplayer.Name)
	bindableEvent.Event:Connect(onEvent)
end)

image

1 Like

where do you declare what is ‘bindableEvent’

2 Likes

in server script service

I needed more characters

but in this script, how do you declare local bindableEvent =

1 Like

local players = game:GetService(‘Players’)

local localplayer = players.LocalPlayer

local Character = localplayer.Character or localplayer.CharacterAdded:Wait()

local Humanoid = Character:WaitForChild("Humanoid")

local bindableEvent = game.ServerScriptService:FindFirstChild('TeleportSpec')

local function onEvent(...)

print(...)

end

Humanoid.Died:Connect(function()

wait(3.8)

local Character = localplayer.Character or localplayer.CharacterAdded:Wait()

print('Moved Position') -- for Debugging

localplayer.hiddenstats.Spectator.Value = true

bindableEvent:Fire(localplayer.Name)

bindableEvent.Event:Connect(onEvent)

end)

oh i think the problem is that you can only put scripts in server script service. other things like the bindable event wont work in there. try putting it in server storage instead

1 Like

Ok sounds good I’ll try. But the Roblox devforum showed an example by putting one in the server script service.

This is a localscript, it can’t access your bindable which is in serverscriptservice

Move it to replicatedstorage

1 Like

image
image
Same problem.

This worked!! However the server script cant pick it up, got any ideas?

local TeleportSpec = game.ReplicatedStorage.TeleportSpec

TeleportSpec.Event:Connect(function(player)
	print('recieved')
	game.Players:WaitForChild(player).Character:MoveTo(Vector3.new(-70.25, 5.75, -472.5)) -- Moves Model using Vector3
end)

Another thing I’ve noticed about the first script. Is that it will only print one time, and wont work the second time. And the second script teleports me back but doesn’t print.

Quite Confused.

it’s a bindableevent, not a remoteevent
make it a remoteevent and read the docs on create.roblox.com/docs for more details

I’ve changed that but now it won’t fire again.

If you are still using :Fire() for the remote event, that is your issue now.

You need to change it to event:FireServer() on the client, then change it to event.OnServerEvent on the server.

1 Like

Thank you this works! This is just what I needed.

Final Script:

local players = game:GetService('Players')
local localplayer = players.LocalPlayer
local Character = localplayer.Character or localplayer.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local RemoteEvent = game.ReplicatedStorage:FindFirstChild('TeleportSpec')

Humanoid.Died:Connect(function()
	wait(3.8)
	local Character = localplayer.Character or localplayer.CharacterAdded:Wait()
	print('Moved Position') -- for Debugging
	localplayer.hiddenstats.Spectator.Value = true
	RemoteEvent:FireServer(localplayer.Name)
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.