So I'm trying to create this RP game, and basically I tried to create a door with the badge required morph behind it. The problem is that whenever I touch the door nothing happens instead of teleporting me beyond the door, making me touch the morph for a brief second and then teleporting me out of the room. Also, the output won't speak. Here's my script:
local badge = game:GetService("BadgeService")
script.Parent.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if badge:UserHasBadgeAsync(plr.UserId, 2124584743) then
hit.Parent.Torso.CFrame = CFrame.new(21.431, -0.028, 64.993)
wait(0.5)
hit.Parent.Torso.CFrame = CFrame.new(4.27, 0.44, 53.917)
end
end
end)

4 comments
Are you sure you don't want to use .Position instead of .CFrame
Using each of them made no difference. After playing around with a bit of print() I figured out where the problem occurs. I don't exactly know why it's happening, but I know that its not doing anything because of line 7.
What is the error?
Well its not doing anything. Even after making a new badge for the game.