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

How to create a Group Only seat? [Solved] [closed]

Asked by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
9 years ago

Hello all! So, I've been frustrated with my script, since it didn't properly function. The script below is supposed to make the person jump if they aren't in the group. It works the first time, but after that, they never jump again. I've tested it in studio, setting up prints, and the code runs all the way through. Is there reason I can't perform the jump more than once? Thanks for any help!

Script:

GroupID = 2549890

function onSit(player, character)
    if not player then return end
    if not player:IsInGroup(GroupID) then
        player.Character.Humanoid.Jump = true
        wait(.1)
    end
end

function onGetUp(player, character)
    if not player then return end
end

script.Parent.ChildAdded:connect(function (c)
    if c:IsA("Weld") and c.Name == "SeatWeld" then
        local char = c.Part1.Parent
        sitter = char
        onSit(game.Players:GetPlayerFromCharacter(char), char)
    end
end)
script.Parent.ChildRemoved:connect(function (c)
    print('55')
    if c:IsA("Weld") and c.Name == "SeatWeld" then
        local char = c.Part1.Parent
        sitter = nil
        onGetUp(game.Players:GetPlayerFromCharacter(char), char)
    end
end)
0
Try and comment out lines 11-13, 22-29, and 18. I do not understand the point of having a .ChildRemoved function. & on line 6, you could shorten the line with the "character" argument. Redbullusa 1580 — 9y

Locked by Redbullusa, UserOnly20Characters, alphawolvess, and EzraNehemiah_TF2

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?