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

Why's this script say the name isn't the same as the StringValue?

Asked by
N33H 19
4 years ago
Edited 4 years ago

I have a car seat script that makes a value in the script folder a players name, and if the Value is not the same as the owner then to print saying it isnt the owner, even though I am the owner it still kicks me out, why?

-- Variables --

local ScriptFolder = script.Parent
local SoundFolder = script.Parent.Parent.Sounds
local WheelFolder = script.Parent.Parent.Wheels
local Seat = script.Parent.Parent.Extras.VehicleSeat
isSitting = false
isIdle = false
local OwnerName = script.Parent.OwnerName

-- Owners Name --

Seat.ChildAdded:Connect(function()
    print ("Sat in car seat.")
                    local LocalPlayerName = Seat.Occupant.Parent.Name
                    local Player = LocalPlayerName
                wait()
        OwnerName.Value = LocalPlayerName
end)

-- Anti Theft --

Seat.ChildAdded:Connect(function()
    if Seat.Occupant.Name ~= OwnerName.Value then
        print("Not Owner")
    end
end)

found out i forgot to put Seat.Occupant.Parent.Name

Answer this question