hello! i have a script that spawns a van when u click a gui button but the problem is is that the wheels clip the baseplate. how would u go about fixing this? ty
video:
script:
local event = game.ReplicatedStorage:WaitForChild("SpawnVan")
local chatService = game:GetService("Chat")
local button = script.Parent
event.OnServerEvent:Connect(function(plr: Player)
local char = plr.Character
if char == nil then return end
--char.Humanoid.WalkSpeed = 0
--char.Humanoid.JumpHeight = 0
wait()
local van = game.ReplicatedStorage:WaitForChild("One Seated Van")
local vanClone = van:Clone()
local rigHead = vanClone.Rig:WaitForChild("Head")
local vcPP = vanClone.PrimaryPart
local hrp = char.HumanoidRootPart
local SpawnOFFSET = CFrame.new(-150,0,-5)
vanClone.Parent = workspace
vanClone:PivotTo(char.HumanoidRootPart.CFrame * SpawnOFFSET)
--tween
local ts = game:GetService("TweenService")
local tsInfo = TweenInfo.new(
3,
Enum.EasingStyle.Linear,
Enum.EasingDirection.In,
0,
false,
0
)
local tsNewLocation = CFrame.new(150,0,-5)
local tweenTrack = ts:Create(vanClone.PrimaryPart, tsInfo ,{CFrame = vanClone.PrimaryPart.CFrame * tsNewLocation})
tweenTrack:Play()
tweenTrack.Completed:Wait()
--chat
task.wait(.3)
local sounds = vanClone.Rig.Head.sounds
chatService:Chat(rigHead, "wagwan bro", Enum.ChatColor.Green)
wait(.2)
sounds.wagwan:Play()
sounds.wagwan.Ended:Wait()
wait(.25)
chatService:Chat(rigHead, "looking like a snack", Enum.ChatColor.Green)
sounds.snacc:Play()
sounds.snacc.Ended:Wait()
wait(.25)
chatService:Chat(rigHead, "HAHAHAHAHAHA 🤣🤣🤣😭😭", Enum.ChatColor.Green)
sounds.laugh:Play()
sounds.laugh.Ended:Wait()
end)
yes cancollide is true. i forgot to post the script mb but what im trying to do is im trying to snap the van to the part that the character is standing on like this:
I’m not sure about your script’s specifics, but we’ve established the end goal: to move the van towards where the player is facing, on the same Y-axis. In your script, you can define the end position as the Y-position of the HumanoidRootPart. This should solve at least half of the problem. For moving it towards where the player is facing, use the character’s LookVector. Please correct me if I misunderstood your question.
Try increasing the Y axis of the van by a little bit when it spawns. Seems a bit hacky but since I don’t have any code to work with, I’m sorta just assuming things right now. Sorry!
the wheels are apart of the model. i changed the y axis and it pretty much works. i think i tried it yesterday but it didnt work as well so it works much better today tysm!
only thing is right. if there’s like a small part like this say its a path, the van will snap to the part and not the road. do u have any ideas to fix this? i think it has to do with raycasting but idk.
Yea raycasting is the only option I see viable here, but I could be wrong. Just a little more complex but there are many resources on the docs and these forums to assist you with that!