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

Faucet onClicked Script help?

Asked by 8 years ago

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)
0
I'm a very beginner at scripting ,I understand but can't do. karaoke60000 0 — 8y
0
you connected a function to an object UniversalDreams 205 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

-- 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"

0
Ok, thanks! karaoke60000 0 — 8y
Ad

Answer this question