Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My script do not work!? No Error (BlindableEvent)?

Okay, I play in Studio and it works, I play in ROBLOX Server and it not works. It print "GameManager loaded.." and that's all. Why?

Error: Any

LocalScript:

repeat wait() until workspace.AccessServer and game.Players.LocalPlayer

print('GameManager loaded...')

function GameFunction()
	print('GameFuncton Enabled')
end

game:GetService('Workspace').AccessServer.StartRound.Event:connect(GameFunction)

Script:

while wait() do
	for i = 5, 0, -1 do
		print(i)
		wait(1)
	end
	game:GetService('Workspace').AccessServer.StartRound:Fire()
	wait(10)
end

1 answer

✓ Accepted answer

It looks like you're using the wrong type of event. You should instead be using a RemoteEvent, because RemoteEvents are intended for cross-communication of scripts and local scripts. BindableEvents are intended for communication of scripts to scripts or local scripts to local scripts.

To fix this issue, remove Workspace.AccessServer.StartRound and replace it with a RemoteEvent named StartRound.

Then, in the code for the LocalScript, change StartRound.Event:connect to StartRound.OnClientEvent:connect, and likewise in the Script, change StartRound:Fire() to StartRound:FireAllClients().

Here is the code for both scripts:

LocalScript:

repeat wait() until workspace.AccessServer and game.Players.LocalPlayer
print('GameManager loaded...')

function GameFunction()
    print('GameFuncton Enabled')
end
 
game:GetService('Workspace').AccessServer.StartRound.OnClientEvent:connect(GameFunction)

Script:

while wait() do
    for i = 5, 0, -1 do
        print(i)
        wait(1)
    end
    game:GetService('Workspace').AccessServer.StartRound:FireAllClients()
    wait(10)
end

1 comment

0

Thanks you!:)

This discussion is preserved as it was. New answers, comments, and votes are closed.