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

clickdetector clicked if Used = True then "Red Line"? [SOLVED]

Asked by 5 years ago
Edited 5 years ago
local TweenService = game:GetService("TweenService")
local Water = script.Parent.Parent.Parent.Water
local Using = false
local Goal = {}
Goal.Size = Vector3.new(1.78, 0.50, 2.48)
local Goal2 = {}
Goal2.Size = Vector3.new(1.78, 0.05, 2.48)
local TwInfo = TweenInfo.new(5)
local TwInfo2 = TweenInfo.new(15)
local Tween = TweenService:Create(Water, TwInfo, Goal)
local Tween2 = TweenService:Create(Water, TwInfo2, Goal2)

script.Parent.ClickDetector.MouseClick:Connect(function()
    if script.Parent.Parent.Parent.IsUsing.Value == true then
        print("yes")
        end
elseif
    script.Parent.Parent.Parent.IsUsing.Value == false then --now this get's red line
    script.Parent["Waterfall Sound Effect"]:Play()
    if script.Parent.Parent.Parent.Sink.WaterGo.WaterFall.Enabled == false then
    script.Parent.Parent.Parent.Sink.WaterGo.WaterFall.Enabled = true
    script.Parent.Parent.Parent.Water.Transparency = 0 
    script.Parent.Parent.Parent.Water.Texture.Transparency = 0.8
Tween:Play()
wait(5)
script.Parent.Parent.Parent.Sink.WaterGo.WaterFall.Enabled = false
script.Parent["Waterfall Sound Effect"]:Stop()
Tween2:Play()
wait(15)
    script.Parent.Parent.Parent.Water.Transparency = 1
    script.Parent.Parent.Parent.Water.Texture.Transparency = 1
        end
        end)

i get red line under elseif what am i doing wrong?

1 answer

Log in to vote
1
Answered by
OnaKat 444 Moderation Voter
5 years ago
Edited 5 years ago

that because you put end before elseif

move end to line 31

your second problem is you put elseif on line 17 but you put then on line 18

Your script will be like this

local TweenService = game:GetService("TweenService")
local Water = script.Parent.Parent.Parent.Water
local Using = false
local Goal = {}
Goal.Size = Vector3.new(1.78, 0.50, 2.48)
local Goal2 = {}
Goal2.Size = Vector3.new(1.78, 0.05, 2.48)
local TwInfo = TweenInfo.new(5)
local TwInfo2 = TweenInfo.new(15)
local Tween = TweenService:Create(Water, TwInfo, Goal)
local Tween2 = TweenService:Create(Water, TwInfo2, Goal2)

script.Parent.ClickDetector.MouseClick:Connect(function()
    if script.Parent.Parent.Parent.IsUsing.Value == true then
        print("yes")    
    elseif script.Parent.Parent.Parent.IsUsing.Value == false then
        script.Parent["Waterfall Sound Effect"]:Play()
     if script.Parent.Parent.Parent.Sink.WaterGo.WaterFall.Enabled == false then
        script.Parent.Parent.Parent.Sink.WaterGo.WaterFall.Enabled = true
        script.Parent.Parent.Parent.Water.Transparency = 0 
        script.Parent.Parent.Parent.Water.Texture.Transparency = 0.8
        Tween:Play()
        wait(5)
        script.Parent.Parent.Parent.Sink.WaterGo.WaterFall.Enabled = false
        script.Parent["Waterfall Sound Effect"]:Stop()
        Tween2:Play()
        wait(15)
        script.Parent.Parent.Parent.Water.Transparency = 1
        script.Parent.Parent.Parent.Water.Texture.Transparency = 1
     end
    end
end)

0
Hey i actually fixed it.Thanks.???? User#21499 0 — 5y
Ad

Answer this question