How to make Part Go Down when i Touch That Part [LocalScript]

I Try Script on LocalScript and Put on PlayerStarter > StarterCharacterScripts
And Script this:

FlingPart.Touched:Connect(function(otherPart)
	local character = otherPart.Parent
	if character:IsA("Model") and character:FindFirstChild("Humanoid") then
		local oldPosition = script.Parent.Position
		script.Parent.Position = Vector3.new(oldPosition.X, 4.000, oldPosition.Z)
	end    
end)

and Test but not work at all, what did i do wrong?

May you please share with me the error you are getting?

1 Like

did u define FlingPart?

local FlingPart = ...
1 Like

image
image
It dont have error or somethin

1 Like

did you make a local for FlingPart?

local FlingPart = ...
1 Like


I am! and idk why STILL NOT WORK!

1 Like

Try change oldPosition line to the following:

local oldPosition = script.Parent.HumanoidRootPart.Position
1 Like

image
It said Script [‘Workspace.Catasangel_2007.FlingOff’, Line 6 ]

1 Like

try printing oldPosition and lmk the results

1 Like

I am kind of confused i do not think i’ll be able to help :sweat_smile: .

do you want TweenService?

Note: Roblox recommends using game:GetService("Workspace") because it is the safest option because it ensures that the Workspace service exists. If the service were to be renamed or removed (which is uncommon for Workspace but possible for other services), this method would prevent errors in your script. In contrast, using game.Workspace or workspace could lead to errors if the service is not found.

2 Likes

Wait try this instead:

local oldPosition = game.Players.LocalPlayer.Character.HumanoidRootPart.Position
game.Players.LocalPlayer.Character.HumanoidRootPart.Position = oldPosition
2 Likes

How to make Part Go Down when i Touch That Part [LocalScript]

do u mean make the part go underground?

1 Like
FlingPart.Touched:Connect(function(otherPart)
	local character = otherPart.Parent
	if character:IsA("Model") and character:FindFirstChild("Humanoid") then
		local oldPosition = script.Parent.HumanoidRootPart.Position
		script.Parent.Position = Vector3.new(oldPosition.X, 4.000, oldPosition.Z)
		print(oldPosition)
	end    
end)

Same Error

How to make Part Go Down when i Touch That Part [LocalScript]

do u mean make the part go underground??

Well. why do you ask that in the title and is it

Because i think that english is not your first language (no offense)
and i want to understand what you want the part to do.

If you want to make the part go underground, do this:

FlingPart.Touched:Connect(function(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    if player then
        FlingPart.Position = Vector3.New (0, 10, 0) -- change it to the desired number
    end
end)
1 Like

@Catasangel_2007 to be honest, the function that should happen if the FlingPart is touched has nothing to do with “FlingPart”. that’s why im confused.