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

(Solved)How can I do so when I click with the mouse pointer?

Asked by
brok4d 77
6 years ago
Edited 6 years ago

Hello again, I have a problem when I often click with the mouse the string and its components are not destroyed I have to do it very slowly, I have the variable clicked on false then within the function I set it to true, the string is triggered and create the components then in elseif I have it put true and then false, I put the script there is no better method to do this?

01if Clicked == false and Mouse.Target ~= nil and character:WaitForChild('HumanoidRootPart') then
02 
03    Clicked = true
04 
05    local Pos = Mouse.Hit.p
06 
07    if character:FindFirstChild('HumanoidRootPart') then
08        local Sound = Instance.new('Sound',character:WaitForChild('HumanoidRootPart'))
09        Sound.SoundId = 'rbxassetid://231731980'
10        Sound:Play()
11        wait(1)
12        Sound:Destroy()
13    end
14 
15    ancla = Instance.new('Part',workspace)
View all 50 lines...

I also put the complete script. https://pastebin.com/730A5996

0
I spent the whole afternoon trying to solve it and I solved it, it was the wait (1) after Sound and I put the sound of destroying the Sound in its place where I destroy the other objects. I am sorry and thank you. brok4d 77 — 6y

Answer this question