Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

"Expected identifier, got ')' " any solution?

Heyo! So like i have this teleport brick that doesnt teleport when i add sound and stuff to it, but it works fine if i remove those stuff in the script.. I'm kinda new to Lua, but heres the script.

wait(3)

local cutmusic = game.Workspace.cutmusic4.Sound
local camera = game.Workspace.CurrentCamera
local SceneBlur = game.Lighting.CutBlur
local tele1 = script.Parent.hTele1
local tele2 = script.Parent.hTele2
local debounce = false

tele1.Touched:Connect(function(touched)
	if touched.Parent:FindFirstChild("Humanoid") and debounce == false then
		print("Touched house tele1, half way.")
		local char = touched.Parent
		local humanoidrootpart = char.HumanoidRootPart
		
		camera.CameraType = Enum.CameraType.Scriptable
  		camera.CFrame = game.Workspace.cutcams.Part1.CFrame
		
		local sound = Instance.new("Sound", game.Workspace.Doorbellsound)
		sound.SoundId = "rbxassetid://131558930"
		game.Workspace.Doorbellsound.Sound.Playing = true
			if not sound.IsLoaded then
				sound.Loaded:wait()
		
		wait(2.5)
		
		local sound = Instance.new("Sound", game.Workspace.Dooropensound)
			sound.SoundId = "rbxassetid://157167203"
			game.Workspace.Dooropensound.Sound.Playing = true
				if not sound.IsLoaded then
				sound.Loaded:wait()
		
		SceneBlur.Enabled = false
		
		game.Workspace.cutmusic4.Sound.Volume = 0.5
		game.Workspace.cutmusic4.Sound.Volume = 0.4
		game.Workspace.cutmusic4.Sound.Volume = 0.3
		game.Workspace.cutmusic4.Sound.Volume = 0.2
		game.Workspace.cutmusic4.Sound.Volume = 0.1
		game.Workspace.cutmusic4.Sound.Volume = 0
		game.Workspace.cutmusic4.Sound.Playing = false
		
		camera.CameraType = Enum.CameraType.Custom
		
		SceneBlur.Enabled = false
		humanoidrootpart.Position = tele2.Position
		print("Touched house tele2, All working.")
		
	end
end)

Any solution or tips are welcome!

3 comments

0

What line?

0

last one

0

on line 22 & 30, you are using the if statement when there is no end

1 answer

You've forgotten some ends after the if statements. Here is the fixed script down below, I've also made it efficient.

local cutmusic = game.Workspace.cutmusic4.Sound
local camera = game.Workspace.CurrentCamera
local SceneBlur = game.Lighting.CutBlur
local tele1 = script.Parent.hTele1
local tele2 = script.Parent.hTele2
local debounce = false

wait(3)

tele1.Touched:Connect(function(touched)
    if touched.Parent:FindFirstChild("Humanoid") and debounce == false then
        print("Touched house tele1, half way.")
        local char = touched.Parent
        local humanoidrootpart = char.HumanoidRootPart

        camera.CameraType = Enum.CameraType.Scriptable
        camera.CFrame = game.Workspace.cutcams.Part1.CFrame

        local sound = Instance.new("Sound", game.Workspace.Doorbellsound)
        sound.SoundId = "rbxassetid://131558930"
        game.Workspace.Doorbellsound.Sound.Playing = true
            if not sound.IsLoaded then
                sound.Loaded:wait()

        wait(2.5)

        local sound = Instance.new("Sound", game.Workspace.Dooropensound)
            sound.SoundId = "rbxassetid://157167203"
            game.Workspace.Dooropensound.Sound.Playing = true
                if not sound.IsLoaded then
                sound.Loaded:wait()

        SceneBlur.Enabled = false

        game.Workspace.cutmusic4.Sound.Volume = 0.5
        game.Workspace.cutmusic4.Sound.Volume = 0.4
        game.Workspace.cutmusic4.Sound.Volume = 0.3
        game.Workspace.cutmusic4.Sound.Volume = 0.2
        game.Workspace.cutmusic4.Sound.Volume = 0.1
        game.Workspace.cutmusic4.Sound.Volume = 0
        game.Workspace.cutmusic4.Sound.Playing = false

        camera.CameraType = Enum.CameraType.Custom

        SceneBlur.Enabled = false
        humanoidrootpart.Position = tele2.Position
        print("Touched house tele2, All working.")
     end
     end
    end
end)

6 comments

0

Thank u i will try it real quick!

0

It still doesnt work for some reason

0

Wait let me try again

0

Same error?

0

No nothing now but still doesnt work

1

..Your script is messed up, I fixed the ends. You should mark this as the answer as I fixed the ends.

This discussion is preserved as it was. New answers, comments, and votes are closed.