Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

[SOLVED]Why is the trail size smaller than expected?

I am trying to make a click to move script, and it works fine but I tried making a trail of the path the player will be taking, but it failed horribly.

LocalScript:

Plr=game.Players.LocalPlayer
Plr.PlayerScripts.ControlScript:Destroy()
Mouse=Plr:GetMouse()
repeat wait() until Plr.Character
Char=Plr.Character
CircleMesh = game.ReplicatedStorage.CircleMesh
local Secret=Instance.new("Message")
Secret.Name="Local"
Secret.Parent=Char
Hover=Instance.new("Part")
Hover.Parent = Secret
Hover.Name=Plr.Name.."'s Hover Block"
Hover.FormFactor="Custom"
Hover.Size=Vector3.new(3,.2,3)
Hover.CanCollide=false
Hover.Anchored=true
Hover.Transparency = 1
Mouse.TargetFilter=Hover

Mouse.Button1Down:Connect(function() --Moves character to target position
 if Plr.Character.Humanoid.Health ~=0 and Plr.Character.Humanoid.Health >= 5 then
   Char.Humanoid.WalkToPoint=Hover.Position	
   local Trail = Instance.new("Part")
   Trail.Parent = Hover
   Trail.Name = "Trail"
   Trail.CanCollide = false
   Trail.Anchored = false
   Trail.BrickColor=BrickColor.new("Lime green") 
   Trail.Size = Vector3.new(1,2,Hover.Position - Plr.Character.LowerTorso.Position)
   print(Trail.Size)	

It always printed: 1, 2, 0.0500000007, any ideas?

7 comments

0

Well the size will most likely always be the same because the hover position is never updated to any new value. Try updating the position of Hover on a onMouseHover event.

0

Do you mean Mouse.Move?

0

Yes try using that event and keep updating the hovers position with the mouse x, y

0

I tried this : Hover.Position=Vector3.new(Mouse.Hit.X,Mouse.Hit.Y,Mouse.Hit.Z), still the same number

0

Ok, I Figured out a way, Here's the script now local X=Mouse.Hit.X local Y=Mouse.Hit.Y local Z=Mouse.Hit.Z local X2=Plr.Character.HumanoidRootPart.Position.X local Y2=Plr.Character.HumanoidRootPart.Position.Y local Z2=Plr.Character.HumanoidRootPart.Position.Z local DisX=math.abs(X-X2) local DisY=math.abs(Y-Y2) local DisZ=math.abs(Z-Z2)

0

local Distance=DisX+DisY+DisZ

0

Trail.Size = Vector3.new(1,2,Distance)

1 answer

I think you forgot last number in Trail.Size - Vector3.new in Studio 0.05 it's minimal number

1 comment

0

Trail.Size = Vector3.new(1,2,Hover.Position - Plr.Character.LowerTorso.Position) ....

This discussion is preserved as it was. New answers, comments, and votes are closed.