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

Union is not a valid member of Player?

Asked by 9 years ago

Ok so the teleport script I have it has to be the same name for the models but How can Union not be a vaild member of Player if it's in the model? I'm trying to get it to probably animate and I can't do game.Workspace.InstantTeleport.Union it won't work with that. So how can I animate the brick without having to do that? and not saying this Union is not a valid member of Player. Also if anyone is wounding what me is it's a variable for game.Players.LocalPlayer

local me = game.Players.LocalPlayer
local locations = script.Parent:WaitForChild("Locations")
local porter = script.Parent:WaitForChild("Porter").Value
local groupserv = game:GetService("GroupService")
local selected = 2
local selloc = nil
local location = {}
local gui = script.Parent:WaitForChild("selection")

function gatherLocations()
    for i, v in pairs(locations:GetChildren())do
        table.insert(location, {v.Name, v.Value})
    end
end

function before()
    if(selected-1 <= 0)then
        return location[#location]
    else
        return location[selected-1]
    end
end

function after()
    if(selected+1 > #location)then
        return location[1]
    else
        return location[selected+1]
    end
end

function loadScenery()
    local b = before()
    local a = after()
    gui.card1.lname.Text = b[1]
    gui.cardview.lname.Text = location[selected][1]
    gui.card2.lname.Text = a[1]
    selloc = location[selected][2]
    gui.cardview.grouperror.Visible = false
end

function nextvals()
    if(selected+1>#location)then
        selected = 1
    else
        selected = selected + 1
    end
    loadScenery()
end

function prevvals()
    if(selected-1<=0)then
        selected = #location
    else
        selected = selected - 1
    end
    loadScenery()
end

gui.left.MouseButton1Click:connect(function()
    prevvals()
end)

gui.right.MouseButton1Click:connect(function()
    nextvals()
end)

gui.cancel.MouseButton1Click:connect(function()
    local teleport = Instance.new("IntValue", me)
    teleport.Name = "JustTeleported"
    game:GetService("Debris"):AddItem(teleport, 5)
    me.Character.Humanoid.WalkSpeed = 16
    porter.User.Value = nil
    local Part = script.Parent.Parent.Parent.Union
    for i = 1, 10 do
        me.Part.CFrame = me.Part.CFrame * CFrame.new(0,-1,0)
        wait(1)
    end
    script.Parent:Destroy()
end)

gui.teleport.MouseButton1Click:connect(function()
    if not selloc then return end
    if(selloc.Group.Value ~= 0)then 
        local infoassoc = groupserv:GetGroupInfoAsync(selloc.Group.Value)
        if(infoassoc and (not me:IsInGroup(selloc.Group.Value)))then 
            gui.cardview.grouperror.Text = "Teleport Failed: You're not in the group \""..infoassoc.Name.."\""
            gui.cardview.grouperror.Visible = true
            return 
        end
    end
    local teleport = Instance.new("IntValue", me)
    teleport.Name = "JustTeleported"
    game:GetService("Debris"):AddItem(teleport, 5)
    gui.Visible = false
    wait(2)
    porter.User.Value = nil
    me.Character:MoveTo(selloc.Porter.Position)
    me.Character.Humanoid.WalkSpeed = 16
    local Part = script.Parent.Parent.Parent.Union
    for i = 1, 10 do
        me.Part.CFrame = me.Part.CFrame * CFrame.new(0,-1,0)
        wait(1)
    end
    script.Parent:Destroy()
end)

gatherLocations()
wait(.01)
loadScenery()
0
Make sure that your hierarchical calling is correct. Make sure you are locating it in the right position and are not making a simple mistake. FearMeIAmLag 1161 — 9y
1
It is in the right location and all but in the output it says Union is not a valid member of Player Anciteify 70 — 9y
0
whice its not suppose to be part of player its suppose to be the model which i got the parent right Anciteify 70 — 9y
0
which Line is the error located in? And where is this script located? Kryddan 261 — 9y
0
Line 19 and it's located in a Screen GUI Anciteify 70 — 9y

1 answer

Log in to vote
0
Answered by
woodengop 1134 Moderation Voter
9 years ago

The Reason why you have Union is not a valid member of Player, because You need to use the Characternot the Player. To do that we need to add game.Players.LocalPlayer.Character

0
How would I add that in? Anciteify 70 — 9y
0
Can you show the whole script? woodengop 1134 — 9y
0
yup just edited the post Anciteify 70 — 9y
0
You can't hold Values on Variables. woodengop 1134 — 9y
View all comments (2 more)
0
Well this script is in a ScreenGui which is in PlayerGUI's when it opens how can I find Union then? Anciteify 70 — 9y
0
line 102 you have me.Part, it should be me.Character.Parent woodengop 1134 — 9y
Ad

Answer this question