Trying to get the part to spin all the time till a player touched the part than remove the script. I am very new to this. This is what I have and it does not work.
local player = game.Players.LocalPlayer local part = script.Parent if part.Name == "Main" then script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(.01,0,0) wait() else if player:Touched(part) then script:Destroy() end end player.Character.Humanoid.Touched:connect (part)
This is because :connect is deprecated, use :Connect.
You tried to pass an object to the :Connect method, which it must be a function.
Also make sure its a Local script to use LocalPlayer
.
local plr = game:GetService('Players').LocalPlayer function onTouch(part, humanoidPart) if part.Name == 'Main' then part.CFrame = part.CFrame * CFrame.fromEulerAnglesXYZ(.01, 0,0) elseif part.Parent == plr.Character then -- if the part parent is of the character script:Destroy() end end plr.Character.Humanoid.Touched:Connect(onTouch)