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

I need help with ClickDetector in my part PetClick ?

Asked by 4 years ago
Edited 4 years ago

I have part named PetClick I want if player click on the part the pet follow them and I want also delete PetClick part if i click on part the pet follow player but the part dont delete this is my script

01local pet = script.Parent
02 
03function givePet (player)
04    if player then
05        local character = player.Character
06        if character then
07            local humRootPart = character.HumanoidRootPart
08            local newPet = pet:Clone()
09            newPet.Parent = character
10 
11            local bodyPos = Instance.new("BodyPosition", newPet)
12            bodyPos.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
13 
14            local bodyGyro = Instance.new("BodyGyro", newPet)
15            bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
View all 31 lines...
0
Line 30, you shouldn't use the "and" and call the functions from seperate lines marijus06 68 — 4y
0
what i can use MONSTERGAMES3609 14 — 4y
0
Replace the 30 line with givePet(Player) and add another line and write PetClick:Destroy() marijus06 68 — 4y
0
dont work the part dont destroy the pet follow me only but the part dont destroy MONSTERGAMES3609 14 — 4y
View all comments (4 more)
0
can you vote to my question MONSTERGAMES3609 14 — 4y
0
Then you should try destroying the part first and then calling the give pet function marijus06 68 — 4y
0
thank you sooooooooooooooooooooooooo much thank you MONSTERGAMES3609 14 — 4y
0
put your answer in answers to make it correct answer thank you so much i try to make this for months thank you you are the best thank you sooooooo much MONSTERGAMES3609 14 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Replace the 30 line with givePet(Player) and add another line and write PetClick:Destroy() Then you should try destroying the part first and then calling the give pet function Answers by marijus06

Ad

Answer this question