Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

I am having problems with a RemoteEvent?

Asked by 4 years ago

Hey everyone reading this!

I am having problems with a RemoteEvent not being able to fire server --> client.

Server Script:

01local debounce = false
02 
03script.Parent.Touched:Connect(function(hit)
04    local humanoid = hit.Parent:FindFirstChild("Humanoid")
05    print("No Humanoid")
06 
07    if debounce == false then
08        debounce = true
09        if humanoid then
10            print("Humanoid")
11            local player = game.Players:GetPlayerFromCharacter(hit.Parent)
12 
13            script.Parent:WaitForChild("Triggered"):FireClient(player)
14        end
15    end
16end)

Local Script:

01local uIS = game:GetService("UserInputService")
02local looping = true
03 
04while looping do
05    wait()
06    script.Parent:WaitForChild("Triggered").OnClientEvent:Connect(function(player)
07        looping = false
08        script.Parent.CanCollide = false
09        print("Vault Tutorial Triggered")
10        local player = game.Players.LocalPlayer
11        local tutorialGui = player.PlayerGui:WaitForChild("TutorialGui")
12        local autoMove = player.PlayerScripts:WaitForChild("AutoMove").Disabled
13        local vault = tutorialGui:WaitForChild("Vault")
14 
15        vault.Visible = true
View all 25 lines...

I'm not getting any errors, but the script inside of the OnClientEvent doesn't play.

Thank you for reading! Any help is appreciated!

0
You aren't setting the debounce variable back to false, so it won't pass more than once. That is unless you intend to do so. DeceptiveCaster 3761 — 4y
0
My intention with the debounce is to keep a player from using the trigger more then once. Thanks for replying anyways. ColdFoxy07 76 — 4y
0
I would also not recommend looping event listeners. Every time the loop iterates it creates a new event listener, so you are going to have an incredibly unnecessary number of event listeners. DeceptiveCaster 3761 — 4y
0
What are the prints after you run once? Xapelize 2658 — 4y
View all comments (2 more)
0
I ran it, here are the prints: ColdFoxy07 76 — 4y
0
 17:27:04.417 No Humanoid - Server - VaultScriptServer:5   17:27:04.417 Humanoid - Server - VaultScriptServer:10   17:27:04.517 ? No Humanoid (x8) - Server - VaultScriptServer:5 ColdFoxy07 76 — 4y

Answer this question