I’ve been trying to figure out this script for quite a while now. The whole goal is to trigger an animation when a touch part is touched.
- Grill Table is the model that contains the touch part and is located under explorer.
- Grill is the model after appears after the animation is triggered.
- ShawarmaGrill is the tool which the animation takes place.
Please help.
local GrillTable = script.Parent
local TouchPart = GrillTable.TouchPart
local Grill = GrillTable.Grill
local Debounce = false
local ShawarmaGrill = script.Parent
local Animation = ShawarmaGrill.Animation
TouchPart.Touched:Connect(function(PartThatTouched)
if Debounce == false then
local ShawarmaGrill = PartThatTouched.Parent
local Character = ShawarmaGrill.Parent
if ShawarmaGrill.Name == "ShawarmaGrill" then
Debounce = true
ShawarmaGrill.Parent = game.ServerStorage
Character.Humanoid.WalkSpeed = 0
Character.Humanoid.JumpPower = 0
Character.HumanoidRootPart.Position = script.Parent.Positioner.Position
Character.HumanoidRootPart.Orientation = script.Parent.Positioner.Orientation
---------
local Anim = Instance.new("Animation",Character)
Anim.AnimationId = script.Parent.InteractAnim.AnimationId
Anim = Character.Humanoid:LoadAnimation(Anim)
Anim:Play()
wait(1)
script.Parent.Grill.Transparency = 0
Character.Humanoid.WalkSpeed = 16
Character.Humanoid.JumpPower = 50
end
end
end)