BindableEvent's

Hello, i have the problem that i want to spawn a Package with a script when a GUI button is Pressed, i have tried to fire a BindableEvent so a normal script spawn the package, But nothing happens!
i found out that the Event not fired, so my Question is if it is possible to fire a BindableEvent from a Local Script.

Script:

script.Parent.Spawning.Event:Connect(function()
	local InsertService = game:GetService("InsertService")
	local model = InsertService:LoadAsset(script.Parent.FahrzeugID)
	model.Parent = workspace.Clones
end)

Local Script:

local Player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.Visible = false
	script.Parent.Parent.Parent.Spawning:Fire()
end)
2 Likes

BindableEvent goes between client-client or server-server
RemoteEvent goes between client-server

if your insert model script is also on client side then it should work
you can add print() to see if it entered the function

yes, but only if the bindable is in a location accessible to the client and only if the subscriber has called connect on the client, if the bindable is in serverstorage, or your handler is connected in a server script, nothing will happen, if you need client - server communication, use Remote Events.

RemoteEvent | Documentation - Roblox Creator Hub

so you mean i should use a RemoteEvent?

Create a BindableEvent. Change “Spawning” to whatever you name it. Server Script:

 local ReplicatedStorage = game:GetService("ReplicatedStorage")
local InsertService = game:GetService("InsertService")
local spawningEvent = ReplicatedStorage:WaitForChild("Spawning")

spawningEvent.Event:Connect(function(fahrzeugID)
    local model = InsertService:LoadAsset(fahrzeugID)
    model.Parent = workspace.Clones
end)

Local Script:

 local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Player = game.Players.LocalPlayer
local spawningEvent = ReplicatedStorage:WaitForChild("Spawning")

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.Visible = false
    spawningEvent:Fire(script.Parent.FahrzeugID) 
end)

Thank’s, i have already a other Idea how to spawn to Package, but Thx

1 Like

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