Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My badge required door isn't responding my script. How do I fix this?

Asked by 4 years ago

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:

01local badge = game:GetService("BadgeService")
02 
03script.Parent.Touched:Connect(function(hit)
04    local humanoid = hit.Parent:FindFirstChild("Humanoid")
05    if humanoid then
06        local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
07        if badge:UserHasBadgeAsync(plr.UserId, 2124584743) then
08            hit.Parent.Torso.CFrame = CFrame.new(21.431, -0.028, 64.993)
09            wait(0.5)
10            hit.Parent.Torso.CFrame = CFrame.new(4.27, 0.44, 53.917)
11        end
12    end
13end)
0
Are you sure you don't want to use .Position instead of .CFrame mixgingengerina10 223 — 4y
0
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. Prxticles 13 — 4y
0
What is the error? SteamG00B 1633 — 4y
0
Well its not doing anything. Even after making a new badge for the game. Prxticles 13 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

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.

0
You can't even use the teleport service if you keep your maps separate. SteamG00B 1633 — 4y
0
Huh. The teleport service worked for me. Prxticles 13 — 4y
Ad
Log in to vote
0
Answered by
NotedAPI 810 Moderation Voter
4 years ago

Hello, Prxticles.

Another way you could do this so it could be smoother is by using a LocalScript and putting it inside of StarterPlayerScripts.

1local Client = game.Players.LocalPlayer
2local BadgeService = game:GetService("BadgeService")
3local Door = -- Path to your door
4 
5if BadgeService:UserHasBadgeAsync(Client.userId, 2124584743) then
6    Door.CanCollide = false
7end

Answer this question