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

Faucet onClicked Script help?

In ROBLOX Studio, I was editing a faucet to make it dispense water using trancperency changes via script and Click Detector. It said there was an error on Line 1. Please tell me what's wrong with the script.

function hotWater(onClicked)
	if script.Parent.Parent.Water.Transparency = 0.48 then
		script.Parent.Parent.Water.Transparency = 0
	end
	else script.Parent.Parent.Water.Transparency = 0.48
end

script.Parent.ClickDetector:connect(onClicked)

2 comments

0

I'm a very beginner at scripting ,I understand but can't do.

0

you connected a function to an object

1 answer

-- Replace your last line where you call the script to be executed to this.

script.Parent.ClickDetector.MouseClick:connect(HotWater)

-- HotWater is the name of your function and you do not need the arguments "onClicked"

1 comment

0

Ok, thanks!

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