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

Surface GUI Ship Spawning Script Not Working. Will Someone Please Help Me?

Asked by 5 years ago
Edited by User#24403 5 years ago

So I have a block where you click a surface GUI and it spawns a ship if you have the correct rank. I have the leader stats already made and working well.

I always get these errors

Solo Player Studio Mode: owner is not a valid member of Players

Live Game Studio Mode: No Output Errors (even with print("test"))

Live Game: Since I'm not the owner of the game and working on making it with them, can't see the f9 output logs...

Here is my code so far----

function onClicked()
    local owner = script.Parent.Parent.Parent.Parent.Parent.owner.Value

    if game.Players.owner.leaderstats.Rank.Value == 0 or game.Players.owner.leaderstats.Rank.Value > 0 then
        local ship = game.Lighting.Ships.Stinger:Clone()
        ship.Parent = script.Parent.Parent.Parent.Parent.Parent.Ships
        ship.Position = script.Parent.Parent.Parent.Parent.Parent.cps.Customize.Position
    elseif not game.Players.owner.leaderstats.Rank.Value == 0 or not game.Players.owner.leaderstats.Rank.Value > 0 then
        print("ERROR: Incorrect Rank")
    end
end

script.Parent.MouseButton1Down:connect(onClicked)

(gaaa all my titles wont work because it needs to be described concisely)

0
sorry for the weird title WyattagumsBackUp 5 — 5y
0
instead of == 0 or > 0 do >= 0 HappyTimIsHim 652 — 5y
0
Pt the code in a code block. User#24403 69 — 5y
0
Is the "owner" value a StringValue or an ObjectValue? MyNameIsChill 15 — 5y
View all comments (6 more)
0
tanx for the tip HappyTimIsHim! WyattagumsBackUp 5 — 5y
0
owner is StringValue @MyNameIsChill WyattagumsBackUp 5 — 5y
0
You can do game.Players:FindFirstChild(owner) then. Also, you should set the position of objects using CFrame. MyNameIsChill 15 — 5y
0
I use setting position by making a primary part (it's been working but thanks for the tip, I'll use c frame if it doesn't work, by working I mean on other projects when I tp models) WyattagumsBackUp 5 — 5y
0
Thanks it worked great, since my teleporting didn't work for some reason, I guess it doesn't work anymore :P, Ima use c frame, Ima look up some tutorials but if you have a suggestion or way specifing how to implement into my script please do respond. Again, thank you for the answer and I'll give you as much rep as I can WyattagumsBackUp 5 — 5y
0
Also post the findfirstchild answer as an answer just in case someone needs this help, you decide, you do you :P cya tanx WyattagumsBackUp 5 — 5y

Answer this question