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)
I think the problem that is occuring is that the badge is not exactly from the game the script is in. For the RP game I've created, theres the main menu first, and then you select your desired map. I keep my maps seperate, and since I had the badge on the menu game, the script on the map game didn't work. I did waste a couple robux because of this, but I completely understand the meaning behind it. If this script actually worked, it would allow players to get badges from other popular games without actually achieving it.
Hello, Prxticles.
Another way you could do this so it could be smoother is by using a LocalScript and putting it inside of StarterPlayerScripts.
local Client = game.Players.LocalPlayer local BadgeService = game:GetService("BadgeService") local Door = -- Path to your door if BadgeService:UserHasBadgeAsync(Client.userId, 2124584743) then Door.CanCollide = false end