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

FireAllClients RemoteEvent doesn't seem to be working?

Asked by
Aozwel 71
4 years ago

Hey there,

I created these OnTouch remote event which when touched should trigger a GUI to pop up on all Players screens, But im not sure whats wrong in my code?

Brick (Server) =

local host = script.Parent
local myThread = coroutine.running()
debounce=false

if debounce then return end
script.Parent.Touched:Connect(function(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)


    debounce = true
    host:Destroy()
    game.ReplicatedStorage.dialogTrigger:FireAllClients()
    wait(10)
        debounce = false
end)

GUI (LocalScript) =

-- STAGE 2
local dialogGui = script.Parent
local object = script.Parent
local host = workspace.Host
local guiObject = script.Parent

-- Local type writer
function localTypeWriter(textElement, goal)
    for i=1, string.len(goal), 1 do
        textElement.Text = string.sub(goal,1,i)
        wait(-1.3)
    end
end



game.ReplicatedStorage.dialogTrigger.OnClientEvent:Connect(function()

end)

debounce=false

if debounce then return end

workspace.Host.Touched:Connect(function(hit) 
    if hit.Parent:findFirstChild("Humanoid") then 
        guiObject.Visible = true
debounce = true

        -- Require module

        --coroutine.yield()
        wait(.1)
        localTypeWriter(script.Parent, "Head on over to the Potion Class!")
        wait(3)
        localTypeWriter(script.Parent, "Hello there students my name is Professor Herbert")
        wait(3)
        localTypeWriter(script.Parent, "Would you like to help me create my newest Potion?")
        wait(3)
        localTypeWriter(script.Parent, "Great! I'll need the following ingredients..")
        wait(3)
        localTypeWriter(script.Parent, "They should all be hidden somewhere within the classes go look!")
        wait(3)
        localTypeWriter(script.Parent, "Make sure to return to me once you find them all!")
        wait(3)



        object.AnchorPoint = Vector2.new(0, 0)
        object.Position = UDim2.new{0, 0},{0, 0}


        object:TweenPosition(UDim2.new(0, 0, -10.04, 0), Enum.EasingDirection.In, Enum.EasingStyle.Sine,0.5)

        wait(2)

        script.parent.Visible = false
        if script.parent.Visible == false then 
            print("Worked3!")


        end
        end
    end)

Thanks,

0
# lon233bcc 31 — 4y
0
nice Aozwel 71 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

Well from your code, the event is firing correctly but the connection to the event on the local script doesn't do anything.

game.ReplicatedStorage.dialogTrigger.OnClientEvent:Connect(function()
    --you should put code here that makes the GUI pop up
end)
0
That didn't seem to change anything?, I feel like its something else in my code causing it to glitch out Aozwel 71 — 4y
0
Fixed Aozwel 71 — 4y
Ad

Answer this question