Hey reader! I have been working with sound regions, and it has started some problems. When the player touches a checkpoint, they then spawn on top of the sound region box, then fall. This also is happing when the player teleports. If you know how to resolve this, please let me know. Thanks!
Show your script, because I don’t know how your “checkpoint/sound region” system works.
Also, it may be because you have CanCollide on for something.
:MoveTo(Vector3) automatically accounts for obstructions, maybe instead try :SetPrimaryPartCFrame(CFrame)
I think I messed it up somewhere, because I start right back at the spawn. This is what I wrote
- Incorrect casing, use :SetPrimaryPartCFrame
Theres a few grammar mistakes and vector mistakes. Try using something like this:
character:SetPrimaryPartCFrame(storedCheckpoint.CFrame + Vector3.new(0, 3, 0))
This snippet will teleport the player to your checkpoints CFrame, and then add 3 studs to the position. Since you can add Vector3s to CFrames, this code should work. Also, why are you using math.random? I can’t think of a case where you would want the player to spawn off of the checkpoint.
Sorry, but I’m a bit confused. You’re saying to use :SetPrimaryPartCFrame, I did write that, but I probably put it in the wrong place
SetPrimaryPartCFrame is correct yes, but on your code you have SetPrimaryPartCframe. Unless you fixed this.
Yeah, I noticed it when I was reading it, sorry
Thanks you @luaZingo and @sixfalls . Thank you both for helping me with my problem. I know I can be a bit hard to work with. Thanks again!
after you make the region why not just destroy the part? i made a similar script using tweens to make the change in music more smooth :
first make a folder with all the regions :
then put the sound you want in soundservice with the same name :
(local script inside of player gui)
local Player = game.Players.LocalPlayer
local RegionsHolder = workspace.RegionsHolder
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local SoundManagement = {}
for _,Region in pairs(RegionsHolder:GetChildren()) do
local info = {}
local region3 = Region3.new(Region.Position-(Region.Size/2),Region.Position+(Region.Size/2))
Region.Transparency = 0.6
info.Region = region3
info.Sound = game.SoundService:FindFirstChild(Region.Name)
info.Name = Region.Name
Region:Destroy()
table.insert(SoundManagement,info)
end
while wait() do
for _,soundinfo in pairs(SoundManagement) do
local region = soundinfo.Region
local Sound = soundinfo.Sound
local parts = workspace:FindPartsInRegion3WithWhiteList(region,Player.Character:GetDescendants())
if #parts > 0 then
if Sound.Volume == 0 then
print("Sound")
local tweeninfo = TweenInfo.new(0.5) -- how long you want it to take to ease
local Goal = {}
Goal.Volume = 0.1
local tween = TweenService:Create(Sound, tweeninfo, Goal)
tween:Play()
print("Player is in region: "..soundinfo.Name)
end
else
local tweeninfo = TweenInfo.new(0.5) -- how long you want it to take to ease
local Goal = {}
Goal.Volume = 0
local tween = TweenService:Create(Sound, tweeninfo, Goal)
tween:Play()
end
end
end
Make sure the sound in soundservice is looped and always playing. the use of tweens removes the sharp stop and play of music.
if you need the behavior of the region parts it is
The checkpoint system is run on the server, and deleting the regions would stop new players from hearing the sound.
its being deleted through a local script, so it would not stop new players from hearing the sound. i wasnt addressing the check points just giving an alternative solution to the problem
The OP is using MoveTo and that would still move the character above the region as it still exists on the server.