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