Hey there, new scripter here,
The script works fine but i get an error causing it to not work as intended,
Error = Players.Aozwel.PlayerGui.MainDialogs.Stage2.StatusBar.Frame.TextLabel.LocalScri:47: 'end' expected (to close 'if' at line 15) near '<eof>'
Code =
-- STAGE 2 local dialogGui = script.Parent local ReplicatedStorage = game:GetService("ReplicatedStorage") local object = script.Parent local host = workspace.Host local guiObject = script.Parent local myThread = coroutine.running() 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 local TypeWriter = require(ReplicatedStorage:WaitForChild("TypeWriter")) coroutine.yield() wait(1) TypeWriter.typeWrite(script.Parent, "Head on over to the Potion Class!") wait(1) TypeWriter.typeWrite(script.Parent, "Hello there students my name is Professor Herbert") wait(1) TypeWriter.typeWrite(script.Parent, "Would you like to help me create my newest Potion?") wait(1) TypeWriter.typeWrite(script.Parent, "Great! I’ll need the following ingredients..") wait(1) TypeWriter.typeWrite(script.Parent, "They should all be hidden somewhere within the classes go look!") 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("Worked!") end
Thanks,
Hello, an "end" is expected to close the if at line 15. Your code shoud be:
-- STAGE 2 local dialogGui = script.Parent --local ReplicatedStorage = game:GetService("ReplicatedStorage") local object = script.Parent local host = workspace.Host local guiObject = script.Parent local myThread = coroutine.running() -- Local type writer function localTypeWriter(textElement, goal) for i=1, string.len(goal), 1 do textElement.Text = string.sub(goal,1,i) wait(.2) end end function continueDialog() coroutine.resume(myThread) end host.Touched:Connect(continueDialog) workspace.host.Touched:Connect(function(hit) -- Missing end for this function if hit.Parent:findFirstChild("Humanoid") then -- Missing end for this if guiObject.Visible = true -- Require module --local TypeWriter = require(ReplicatedStorage:WaitForChild("TypeWriter")) --coroutine.yield() -- Ajust the wait values to fit your time. wait(1) 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) 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("Worked!") end end -- Line added end) -- Line added
Or maybe your are missing the end for the if at line 45.
Some identation should help you next time ;)