IsA method issue

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    A teleporter where if the player touches it, it checks for all body parts and pushes them into the main teleporter part.
  2. What is the issue? Include screenshots / videos if possible!

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    None, No.
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- This is an example Lua code block

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

4 Likes

You cannot use Players.Localplayer on the server thats why. Your entire script is a mess im ngl you need to re-write stuff and also format it better

6 Likes

Its a LocalScript.β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž

5 Likes

You are using a numerical loop try using cc[i] instead in your if statement for that error.

5 Likes

You would need to use for i,v loop instead of for i=1,#cc.

4 Likes

the getchildren is actullay a table that contains all the children of the parent so use for i ,v in cc instead

3 Likes

β€œDo” is now marked with red squiggles, that means somethings wrong…

2 Likes

Can you send an image of the code or the code itself?

2 Likes

Here.

2 Likes

Thats because the method is not full.
You would set it up like this:

for i,v in ipairs(cc) do
3 Likes

This didnt fix it, i just got the same error.

3 Likes

Could you send me that script?

2 Likes

Ok.

2 Likes

Copy it and send it here? there’s a lot of typos that needs to be fixed.

2 Likes
local Players=game:GetService("Players")
local Portal=script.Parent
local debounce=false

local connection;connection=Portal.Touched:Connect(function(hit)
local character=hit.Parent
local humanoid=character:FindFirstChild("Humanoid")
if humanoid and debounce==false then
debounce=true
local player=Players:GetPlayerFromCharacter(character)
		if player.Name==game.Players.LocalPlayer.Name then
			local cc=character:GetChildren()
			character:GetChildren()
			for i,v in ipairs(cc) do
				if cc:IsA("Part")then
					local ts=game:GetService("TweenService")
					local tweenInfo=TweenInfo.new(2,Enum.EasingStyle.Elastic,Enum.EasingDirection.In)
					local posa={
						Vector3.new(cc.Position),
						Vector3.new(7.25,6.1,64.25)
					}
					for _,pos in pairs(posa)do
						ts:Create(cc,tweenInfo,{Position=pos}):Play()
						wait(2.5)
				end
			end
			game:GetService("TeleportService"):Teleport(72223100044954)
end
			wait(2)
			debounce=false
			end
	end
end)
3 Likes

I dont like spaces, its just kinda messy.

3 Likes
local Players=game:GetService("Players")
local Portal=script.Parent
local debounce=false

local connection;connection=Portal.Touched:Connect(function(hit)
	local character=hit.Parent
	local humanoid=character:FindFirstChild("Humanoid")
	if humanoid and debounce==false then
		debounce=true
		local player=Players:GetPlayerFromCharacter(character)
		if player.Name==game.Players.LocalPlayer.Name then
			local cc=character:GetChildren()
			for _,v in ipairs(cc) do
				if v:IsA("BasePart")then
					local ts=game:GetService("TweenService")
					local tweenInfo=TweenInfo.new(2,Enum.EasingStyle.Elastic,Enum.EasingDirection.In)
					local posa={
						Vector3.new(cc.Position),
						Vector3.new(7.25,6.1,64.25)
					}
					for _,pos in pairs(posa)do
						ts:Create(v,tweenInfo,{Position=pos}):Play()
						task.wait(2.5)
					end
				end
				game:GetService("TeleportService"):Teleport(72223100044954)
			end
			task.wait(2)
			debounce=false
		end
	end
end)

Here’s fixed version (There was a typo on the If v:IsA("BasePart") then line.

2 Likes

Thank you! It was fixed!β€Ž Im not really good at scripting…

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.