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

Can someone help me? (Read the description, it's a mouthfull.)

Asked by 4 years ago

https://gyazo.com/e4c5b3455921f286491b3a31ea2142ea Oh boy. So. When the code is like this:

script.Parent.Event.OnServerEvent:connect(function(Player)
Sound:Play()
PanelSlideTween:Play()
end

else

"Expected ')' (to close '(' at line 17, got 'else.'" You think closing

script.Parent.Event.OnServerEvent:connect(function(Player))

like this would solve the problem with else, but.. Expected identifier when parsing expression, got ')'

Does anyone know how I could solve this?

Here is the whole script.

local TweenService = game:GetService("TweenService")

local Panel = workspace.Door
local PanelRoot = Panel.Root
local Sound = script.Parent.Part.Sound

local PanelSlideInfo = TweenInfo.new() -- Let's use all defaults here
local PanelSlideTweenClose = TweenService:Create(PanelRoot, PanelSlideInfo, {
    CFrame = PanelRoot.CFrame * CFrame.new(PanelRoot.Size.X - 0.1, 0, 0)
})

local PanelSlideTween = TweenService:Create(PanelRoot, PanelSlideInfo, {
    CFrame = PanelRoot.CFrame * CFrame.new(PanelRoot.Size.X + 0.1, 0, 0)


})
script.Parent.Event.OnServerEvent:connect(function(Player))
Sound:Play()
PanelSlideTween:Play()
end

else

And the script associated with it that triggers the event.

local inputservice = game:GetService("UserInputService")

inputservice.InputBegan:connect(function(i,g)
    if i.UserInputType == Enum.UserInputType.Keyboard then
        if i.KeyCode == Enum.KeyCode.E then
            for _,Door in pairs(workspace.Doors:GetChildren()) do
                local Mag = (Door.Center.Position-game.Players.LocalPlayer.Character.HumanoidRootPart.Position).magnitude
                if Mag <= Door.Range.Value then
                    Door.Event:FireServer()
                    break
                end
            end
        end
    end
end)
0
above the else is no if then event so, idk why you have an else there AntoninFearless 622 — 4y
0
check out my answer WideSteal321 773 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

It's easy to forget how to close a :Connect(function(), you DO NOT use end, instead you use end). Example:

game.Player.PlayerAdded:Connect(function(plr)
-- do stuff
end) -- HERE IS WHAT YOU FORGOT

Also remove the else at the end of your script.

Complete code:

local TweenService = game:GetService("TweenService")

local Panel = workspace.Door
local PanelRoot = Panel.Root
local Sound = script.Parent.Part.Sound

local PanelSlideInfo = TweenInfo.new() -- Let's use all defaults here
local PanelSlideTweenClose = TweenService:Create(PanelRoot, PanelSlideInfo, {
    CFrame = PanelRoot.CFrame * CFrame.new(PanelRoot.Size.X - 0.1, 0, 0)
})

local PanelSlideTween = TweenService:Create(PanelRoot, PanelSlideInfo, {
    CFrame = PanelRoot.CFrame * CFrame.new(PanelRoot.Size.X + 0.1, 0, 0)


})
script.Parent.Event.OnServerEvent:Connect(function(Player)
Sound:Play()
PanelSlideTween:Play()
end) -- HERE IS WHAT YOU FORGOT
-- I DELETED THE else
0
What this guy said PoppyandNeivaarecute 134 — 4y
0
DAMN. I MUST BE REALLY DUMB shkip_not -3 — 4y
Ad

Answer this question