So I did the fallowing code, and put it inside a tree and made it so that every player spawns with a "AxSpeed" Value within there Character, and I tryed it out but it wont work for some reason... can someone help me?
script.Parent.MouseClick:connect(function(player) local AxSpeed = player.Character.AxSpeed.Value player.Character.Torso.Anchored = true wait(AxSpeed) Tree.Trunk.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,0,100) Tree.Foliage1.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,0,100) Tree.Foliage2.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,0,100) Tree.Foliage3.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,0,100) Tree.Foliage4.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,0,100) wait(1) -- I dont cair if the tree wont be on the ground... I can work on the cframe later... Tree.Foliage1.Anchored = false Tree.Foliage2.Anchored = false Tree.Foliage3.Anchored = false Tree.Foliage4.Anchored = false Tree.Trunk.Anchored = false Tree:remove() player.Character.Torso.Anchored = false end) Tree = script.Parent.Parent
Thank you
You have to use a ClickDetector. Define Tree at the top of your code. Use Destroy() instead of Remove(), Remove() is outdated.
--Assuming there is a click detector in the trunk of the tree --Assuming the script is in the trunk of the tree Tree = script.Parent.Parent script.Parent.ClickDetector.MouseClick:connect(function(player) local AxSpeed = player.Character.AxSpeed.Value player.Character.Torso.Anchored = true wait(AxSpeed) Tree.Trunk.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,0,100) Tree.Foliage1.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,0,100) Tree.Foliage2.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,0,100) Tree.Foliage3.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,0,100) Tree.Foliage4.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,0,100) wait(1) Tree.Foliage1.Anchored = false Tree.Foliage2.Anchored = false Tree.Foliage3.Anchored = false Tree.Foliage4.Anchored = false Tree.Trunk.Anchored = false Tree:Destroy() player.Character.Torso.Anchored = false end)
Line 2, for your variable. Don't put ".Value" when defining a variable (I forgot the reason why e.e). When you put the wait(), make it wait(AxSpeed.Value)