Hello. I'm making a game where there's a voting system. When the voting is done, everyone's camera should be placed back to normal. But it doesn't even do that. (There are no error outputs.) I'm using a BindableEvent to get in contact with a LocalScript from a regular script. Here's my following scripts:
Fire BinEvent: (Regular Script in StarterGUI)
local remEvent = game.ReplicatedStorage.Remotes:WaitForChild("RemoteEvent") local remEvent2 = game.ReplicatedStorage.Remotes:WaitForChild("RemoteEvent2") local remEvent3 = game.ReplicatedStorage.Remotes:WaitForChild("RemoteEvent3") local binEvent = game.ReplicatedStorage.Bindables:WaitForChild("Event") local val = script.Parent.votin.votes.votesgiven local val2 = script.Parent.votin.timeleft.decreasing local gui = script.Parent remEvent2.OnServerEvent:Connect(function() script.Parent.votin.timeleft.Text = "15" wait(1) script.Parent.votin.timeleft.Text = "14" wait(1) script.Parent.votin.timeleft.Text = "13" wait(1) script.Parent.votin.timeleft.Text = "12" wait(1) script.Parent.votin.timeleft.Text = "11" wait(1) script.Parent.votin.timeleft.Text = "10" wait(1) script.Parent.votin.timeleft.Text = "9" wait(1) script.Parent.votin.timeleft.Text = "8" wait(1) script.Parent.votin.timeleft.Text = "7" wait(1) script.Parent.votin.timeleft.Text = "6" wait(1) script.Parent.votin.timeleft.Text = "5" wait(1) script.Parent.votin.timeleft.Text = "4" wait(1) script.Parent.votin.timeleft.Text = "3" wait(1) script.Parent.votin.timeleft.Text = "2" wait(1) script.Parent.votin.timeleft.Text = "1" wait(1) script.Parent.votin.timeleft.Text = "0" wait(0.1) script.Parent.votin.notifier.Visible = true wait(3) binEvent:Fire() end)
Receive fire (LocalScript In StarterPlayerScripts)
local binEvent = game.ReplicatedStorage.Bindables:WaitForChild("Event") local camera = workspace.CurrentCamera binEvent.Event:Connect(function() camera.CameraType = Enum.CameraType.Custom end)
Any working answer is appreciated.
as RAFA1608 has stated, BindableEvents are for communicating from server script to server script. You should use a remote event and use FireAllClients instead of bin event and Fire.
and also replace Event event with OnClientEvent
sorry if comments are not useful english is not my first language
LOCALscript in startergui (do not use server script in startergui)
local ReplicatedStorage = game:GetService "ReplicatedStorage" local RemoteEvents = { ReplicatedStorage.Remotes.RemoteEvent; ReplicatedStorage.Remotes.RemoteEvent2; -- [[ Change these to bindable events OR Change bindable to remote and make this server script again. ]] ReplicatedStorage.Remotes.RemoteEvent3; } local Bindable = ReplicatedStorage.Bindables.Event local Gui = script.Parent local votesgiven = Gui:WaitForChild("votin"):WaitForChild("votes"):WaitForChild("votesgiven")\ local notifier = Gui.votin.notifier local timeleft = Gui.votin.timeleft local decreasing = timeleft:WaitForChild("decreasing") RemoteEvents.OnServerEvent--[[ Change this too if you change the remote events ]]:Connect(function() for i = 15, 0, -1 do timeleft.Text = tostring(i) wait(1) end wait(0.1) notifier.Visible = true wait(3) Bindable:Fire()--[[ Change if you change bindable ]] end)
other script
local ReplicatedStorage = game:GetService "ReplicatedStorage" local Bindable = ReplicatedStorage.Bindables.Event local Camera = workspace.CurrentCamera Bindable.Event--[[ Change if you changed the bindable ]]:Connect(function() Camera.CameraType = Enum.CameraType.Custom end)