|
| 30 Jul 2016 09:09 PM |
local function RandomBoatPos(player, boat) --// random position on the map math.randomseed(math.random(-tick(),tick())) local ChosenBoat = BoatsFolder:WaitForChild(boat):Clone() ChosenBoat.Parent = workspace.PlayerBoats ChosenBoat:MakeJoints() print('POS - '..tostring(ChosenBoat.Roof.Position)) ChosenBoat:MoveTo(Vector3.new(math.random(-6000, -4014), 0, math.random(-1130, 853))) local tag = Instance.new("StringValue", ChosenBoat) tag.Name = "BoatOwner" tag.Value = player.Name wait() print(ChosenBoat["Roof"].Position + Vector3.new(0, 10, 0)) return ChosenBoat["Roof"].Position + Vector3.new(0, 10, 0) --// "Roof" is in all boats --return Vector3.new(0, 50, 0) end
It prints the POS but when I try to print ChosenBoat["Roof"].Position it says that Roof is nil. I set up a childremoved event to workspace.PlayerBoats above this code and it confirmed my suspicions that the boat was being destroyed or something somehow. I thought it was because I didn't call MakeJoints but even after I added MakeJoints it still doesn't work. Any idea what's happening?
Ever wanted to learn how to script? Check out my YouTube channel: youtube.com/austintheslayer Want to see me code in action? Follow my twitch: twitch.tv/austinrblx |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2016 09:49 PM |
| It's stumping me as well. The roof shouldn't equal nil, as the part does exist, proven by the part that says "print('POS-'..tostring(ChosenBoat.Roof.Position))" not coming out as nil. The only thing that I've notice that is that after you checked the position the first time, you changed the position and then checked again. Though that shouldn't make the roof equal nil. |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2016 10:12 PM |
| Post the bit where you call it. |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2016 10:16 PM |
why not just ChosenBoat.Roof.Position
This siggy is copyrighted © |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2016 11:13 PM |
Same thing, different notation
Ever wanted to learn how to script? Check out my YouTube channel: youtube.com/austintheslayer Want to see me code in action? Follow my twitch: twitch.tv/austinrblx |
|
|
| Report Abuse |
|
|
Cuyler
|
  |
| Joined: 27 Feb 2006 |
| Total Posts: 3784 |
|
|
| 30 Jul 2016 11:16 PM |
I suggest anchoring the model, adding a welding script, then unanchoring the model when it gets welded (after being added to the Workspace.)
|
|
|
| Report Abuse |
|
|
|
| 30 Jul 2016 11:27 PM |
The best weld script I know is qPerfectionWeld. After adding that it still doesn't work.
Ever wanted to learn how to script? Check out my YouTube channel: youtube.com/austintheslayer Want to see me code in action? Follow my twitch: twitch.tv/austinrblx |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2016 12:13 AM |
asd
Ever wanted to learn how to script? Check out my YouTube channel: youtube.com/austintheslayer Want to see me code in action? Follow my twitch: twitch.tv/austinrblx |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2016 12:32 AM |
asdf
Ever wanted to learn how to script? Check out my YouTube channel: youtube.com/austintheslayer Want to see me code in action? Follow my twitch: twitch.tv/austinrblx |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2016 12:33 AM |
ChosenBoat:WaitForChild("Roof")
also dont use MoveTo
give it a primary part and then use model.SetPrimaryPartCFrame(aCFrame) |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2016 12:35 AM |
:SetPrimaryPartCFrame(aCFrame)
my bad
but yea and MakeJoints is for characters or NPCs or humanoids i believe
you cant magically give something joints unless it has a rig like humanoids |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2016 12:51 AM |
@blarg it still has parts that need to stay together like an npcs :/
and did you see what i said about the whole boat model being nil
Ever wanted to learn how to script? Check out my YouTube channel: youtube.com/austintheslayer Want to see me code in action? Follow my twitch: twitch.tv/austinrblx |
|
|
| Report Abuse |
|
|
Cuyler
|
  |
| Joined: 27 Feb 2006 |
| Total Posts: 3784 |
|
|
| 31 Jul 2016 12:52 AM |
Is the boat dropping through the floor and hitting the falling parts destroy barrier?
|
|
|
| Report Abuse |
|
|
|
| 31 Jul 2016 12:54 AM |
Well, the thing is, it's being spawned on top of smooth terrain water. So it couldn't be dropping through that.
Ever wanted to learn how to script? Check out my YouTube channel: youtube.com/austintheslayer Want to see me code in action? Follow my twitch: twitch.tv/austinrblx |
|
|
| Report Abuse |
|
|
Cuyler
|
  |
| Joined: 27 Feb 2006 |
| Total Posts: 3784 |
|
|
| 31 Jul 2016 12:57 AM |
Well, if it's coming up nil, then there's only a couple explanations. Either a script is destroying the boat, or it's somehow falling through the water and being destroyed by the game. Try breakpointing right after you move the boat into the Workspace and then position your camera where the boat is and unbreakpoint. Maybe you'll see exactly what is happening to it. Oh, also, check the Archivable property. I doubt it's that, but if it was set to false for some reason, it wouldn't be able to be cloned.
|
|
|
| Report Abuse |
|
|
|
| 31 Jul 2016 01:00 AM |
I did a few global searches for destroy() and remove() and such but didn't come up with anything that could've been destroying the boat. I found a couple of conditional statements that might've done it but I commented those out, tested, same result. I'll try breakpoints.
Ever wanted to learn how to script? Check out my YouTube channel: youtube.com/austintheslayer Want to see me code in action? Follow my twitch: twitch.tv/austinrblx |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2016 01:02 AM |
...apparently you can't use breakpoints in team create scripts?
Ever wanted to learn how to script? Check out my YouTube channel: youtube.com/austintheslayer Want to see me code in action? Follow my twitch: twitch.tv/austinrblx |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 31 Jul 2016 01:05 AM |
csgs are better. and use body forces
|
|
|
| Report Abuse |
|
|
|
| 31 Jul 2016 01:06 AM |
ugh
Ever wanted to learn how to script? Check out my YouTube channel: youtube.com/austintheslayer Want to see me code in action? Follow my twitch: twitch.tv/austinrblx |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2016 01:12 AM |
last bump for the night
Ever wanted to learn how to script? Check out my YouTube channel: youtube.com/austintheslayer Want to see me code in action? Follow my twitch: twitch.tv/austinrblx |
|
|
| Report Abuse |
|
|
|
| 31 Jul 2016 06:29 PM |
k
Ever wanted to learn how to script? Check out my YouTube channel: youtube.com/austintheslayer Want to see me code in action? Follow my twitch: twitch.tv/austinrblx |
|
|
| Report Abuse |
|
|