Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why won't the 'hum' play the animation when it touches the part?

local Player = script.Parent.Parent.Parent.Parent
local Character = Player.Character
local Humanoid = Character.Humanoid
script.Parent.RemoteEvent.OnServerEvent:Connect(function()
	local Part = Instance.new("Part")
	Part.Parent = game.Workspace
	Part.BrickColor = BrickColor.new("Baby blue")
	Part.Anchored = true
	Part.Shape = "Ball"
	Part.Position = Vector3.new(Character.HumanoidRootPart.CFrame.X,Character.HumanoidRootPart.CFrame.Y,Character.HumanoidRootPart.CFrame.Z)
	Part.CanCollide = false
	Part.Transparency = 0.35
	
	for i = 1, 50, 2 do
		Part.Size = Vector3.new(i, i, i)
		wait(0.01)
		end
	
	Part.Touched:Connect(function(hit)
	local hum = hit.Parent:findFirstChild("Humanoid")
	if hum and not Humanoid then
		local anim = hum:LoadAnimation(script.Parent.Parent.LawDizzy)
		anim:Play()
		end
	end)


end)


1 answer

✓ Accepted answer

The first parameter of the server event for remote event is always player which fired the event so you don't need to use script.Parent.Parent.Parent.Parent, instead use

script.Parent.RemoteEvent.OnServerEvent:Connect(function(player)
	local character = player.CharacterAdded:Wait() -- So the char is loaded
	-- Your code
end)

and idk what you mean by hum and not humanoid, instead just don't define the Humanoid on Line 03

This discussion is preserved as it was. New answers, comments, and votes are closed.