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

Help on script?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

I want it to be like when you hold click on the brick it disappears and when you let go it reappear, but i am not sure how i do it.

function hold()
    script.Parent.Transparency = 1
end
function unhold()
    script.Parent.Transparency = 0
end

script.Parent.ClickDetector.MouseClick:connect(hold) -- my problems i don't know if MouseClick is correct
script.Parent.ClickDetector.MouseClick:connect(unhold) -- my problems i don't know if MouseClick is correct

1 answer

Log in to vote
2
Answered by
dyler3 1510 Moderation Voter
9 years ago

In order to do this, you would have to access the players mouse. Try this:

function hold(Plr)
    script.Parent.Transparency = 1
    local Val=Plr.PlayerGui.MouseValue
    repeat wait() until Val.Value==false or Plr==nil
    script.Parent.Transparency=0
end

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

Try using that script. I think that it should work, but if not, leave a comment below, and I'll see what I can do.

UPDATE:

Put that first script I updated in the original brick, and then put a BoolValue (Name it MouseValue(Or something else)) in the Startergui with this LOCALscript in it:

Plr=game.Players.LocalPlayer
Mouse=Plr:GetMouse()

Mouse.Button1Down:connect(function()
    script.Parent.Value=true
end)

Mouse.Button1Up:connect(function()
    script.Parent.Value=false
end)

Sorry about the long wait. This is untested only because I don't have time right now. Go ahead and test it and tell me how it works. Make sure you do everything correctly, and I think it should. Again, sorry for the long wait.

0
wait when i tested it not on roblox studio it did not work Anthony9960 210 — 9y
0
Are you sure? I tested it and it worked perfectly. If somethings wrong, i'll try to fix it, but as far as I can see it should work fine. dyler3 1510 — 9y
0
so your sure you tested it in a real game not in roblox studio? Anthony9960 210 — 9y
0
Oh...I see. I'll work on it, hold on. dyler3 1510 — 9y
View all comments (9 more)
0
Sorry about the long wait. It's not tested because I don't have time right now, but I did update it. Follow the instructions and it should work fine I think. Hope I helped :P dyler3 1510 — 9y
0
I did not work i think the problem is around Val in the first script Anthony9960 210 — 9y
0
Whoops, fixed it. Try it now. Sorry about that... dyler3 1510 — 9y
0
Sorry to say but it only turned invisible so :( Anthony9960 210 — 9y
0
Ermagerd, sorry. Wait till I get to an actual computer tonight and i'll test it myself before making another update. Sorry about how long this is takin, i wont give up tho. dyler3 1510 — 9y
0
thanks :) Anthony9960 210 — 9y
0
Ok, finally! I got it to work and it's tested this time. So sorry about how long that took, but I think I got it this time. Please let me know just to make sure :P dyler3 1510 — 9y
0
thanks it works sorry i did not check it for 2 days i did not had time to go on the computer :) Anthony9960 210 — 9y
0
Lol no prob. dyler3 1510 — 9y
Ad

Answer this question