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,
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).
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)