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

FireAllCilents not working for Server?

Asked by
Aozwel 71
4 years ago

Hey there,

I got this working on another Script but for this it doesn't seem to be working i get no Errors however not sure whats missing?

Server=

local host = workspace.Host
local myThread = coroutine.running()
workspace.Host.Touched:Connect(function(hit) 

if game.Players:GetPlayerFromCharacter(hit.Parent) then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)

function continueColorChange()
    coroutine.resume(myThread)
game.ReplicatedStorage.dialogTrigger:FireAllClients(player)

host.Touched:Connect(continueColorChange)
end
end
end)

LocalScript=

-- STAGE 2
local dialogGui = script.Parent
local object = script.Parent
local host = workspace.Host
local guiObject = script.Parent
local myThread = coroutine.running()

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

-- 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

local function continueDialog()
    coroutine.resume(myThread)
end

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

        -- Require module

        --coroutine.yield()

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



        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("Worked2!")
        if hit.Parent:findFirstChild("Humanoid") then

        end
        host:Destroy()
        end
    end 
        end) 
            end)

Thanks,

0
"FireAllClients" > Passes Player Argument Elixcore 1337 — 4y
0
What does that mean exactly?, Sorry im new what would i have to change? Aozwel 71 — 4y

2 answers

Log in to vote
0
Answered by
Abandion 118
4 years ago

FireAllClients fires every client in the game. Here it seems like you only want to fire the event for the player you have defined as player, so you'd just use :FireClient(player).

Ad
Log in to vote
0
Answered by 4 years ago

Soo this is pretty simple. It appears to be an issue on your server script.

Let's break your code down.

local host = workspace.Host
local myThread = coroutine.running()
workspace.Host.Touched:Connect(function(hit) 

if game.Players:GetPlayerFromCharacter(hit.Parent) then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)

function continueColorChange()
    coroutine.resume(myThread)
game.ReplicatedStorage.dialogTrigger:FireAllClients(player)

host.Touched:Connect(continueColorChange)
end
end
end)

Here to send stuff to the client you use: game.ReplicatedStorage.dialogTrigger:FireAllClients(player)

Do you want to send to ALL the clients (aka every player in game?). If so just use: game.ReplicatedStorage.dialogTrigger:FireAllClients()

If you want to send to a specific player, use: game.ReplicatedStorage.dialogTrigger:FireClient(player)

0
I can understand that yes, Tried it out for all clients didn't seem to work?, Anything wrong in my LocalScript i need to change? Aozwel 71 — 4y
0
Doesn't appear so. Check it with a print("Test") at the top. If that fires, it's working and there is an issue in there. Conmmander 479 — 4y

Answer this question