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

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

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

✓ Accepted answer

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)

2 comments

0

Hey i actually fixed it.Thanks.????

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