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

Ontouch brick position (Vector3) with BadgeService?

Asked by 8 years ago

Hello, I'm trying to do a script but it dont work, I want that when someone touches the brick check if you have the badge and run the movement. What is wrong with this script?

BadgeId = 484963036

script.Parent.Head.Touched:connect(function(hit)
    if game:GetService("BadgeService"):UserHasBadge(hit.userId, BadgeId) then
        script.Parent.Position = Vector3.new(20.063, 0.76, 24.606)
    else
        script.Parent.Position = Vector3.new(20.063, -10, 24.606)
    end
end)

1 answer

Log in to vote
0
Answered by
Link150 1355 Badge of Merit Moderation Voter
8 years ago
Edited 8 years ago

Your callback function is given the part that touched script.Parent.Head as first parameter. So hit is a player character's bodypart. UserId is a property of a Player object.

You will have to somehow get the Player object of the player whose bodypart touched script.Parent.Head.

0
How i do that? I do not know almost nothing of scripts DJBrianL 0 — 8y
0
I gave you a hint, but if I give you the final solution straight away, you will never learn. Link150 1355 — 8y
Ad

Answer this question