Discussing fists, tools, and problems!
So now, before detecting the enemies inside the range, how can I make the circle size smaller?
function RayCastEffect(HRP)
local RayParams = RaycastParams.new()
RayParams.FilterDescendantsInstances = {workspace.DebrisFolder}
RayParams.FilterType = Enum.RaycastFilterType.Blacklist
local Angle = 0
for i = 1,30 do
local Size = math.random(2,3)
local Part = Instance.new("Part")
Part.Anchored = true
Part.Size = Vector3.new(1,1,1)
Part.CFrame = HRP.CFrame * CFrame.fromEulerAnglesXYZ(0,math.rad(Angle),0) * CFrame.new(10,5,0)
game.Debris:AddItem(Part,5)
local RayCast = workspace:Raycast(Part.CFrame.p,Part.CFrame.UpVector *- 10, RayParams)
if RayCast then
Part.Position = RayCast.Position + Vector3.new(0,-5,0)
Part.Material = RayCast.Instance.Material
Part.CanCollide = false
Part.CanQuery = false
Part.Color = RayCast.Instance.Color
Part.Size = Vector3.new(Size,Size,Size)
Part.Orientation = Vector3.new(math.random(-180,180),math.random(-180,180),math.random(-180,180))
Part.Parent = workspace.DebrisFolder
local Tween = TweenService:Create(Part,TweenInfo.new(.25,Enum.EasingStyle.Bounce,Enum.EasingDirection.InOut),{Position = Part.Position + Vector3.new(0,5,0)}):Play()
delay(1,function()
local Tween = TweenService:Create(Part,TweenInfo.new(1),{Transparency = 1,Position = Part.Position + Vector3.new(0,-5,0)}):Play()
end)
end
Angle += 25
end
end
Try changing some values, I suspect two values
value 1:
The 10 in there, 10 is the number of studs between the player and the rocks
value 2:
The five is my second suspect, if the studs on the floor are actually half a stud then this one is the right one.
You didn’t really needed to make that forum just to change some values but that’s ok
I actually didn’t make a forum for only this, I want help with something else after finishing this anyway, no one of these works: the (0, -5, 0) is the position, it’s centered in the middle, and the (10) idk, but when lowering it, it dissapears.
Actually, nvm, I don’t want to make you tired with me. Just let me do the detect thing, and then I will tell you if it works.
If there’s no error in the output try making the value bigger instead
Continue changing numbers, seeing what it does and try to understand why it does this, that’s the best advice I can tell
I get an error when creating a shaped ball at the player’s position to detect the enemy inside range instead of handle
Script:
local DetectBall = Instance.new("Part")
DetectBall.Parent = workspace.DebrisFolder
DetectBall.Shape = "Ball"
DetectBall.Position = Player.Character.Torso
DetectBall.Transparency = 0.5
DetectBall.CanCollide = false
DetectBall.CanQuery = false
Error:
Unable to assign property Position. Vector3 expected, got Instance
The torso is not a position, add .Position after torso
Hey, look what I reached.
Now, how can I replace the code to make it, instead of detecting the handle, detect the big ball?
DamageEvent.OnServerEvent:Connect(function(Player)
local DetectBall = Instance.new("Part")
DetectBall.Parent = workspace.DebrisFolder
DetectBall.Shape = "Ball"
DetectBall.Position = Player.Character.Torso.Position
DetectBall.Transparency = 0.5
DetectBall.CanCollide = false
DetectBall.CanQuery = false
DetectBall.Anchored = true
DetectBall.Size = Vector3.new(22, 22, 22)
local connection
connection = handle.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent ~= tool.Parent then
Hit.Parent:FindFirstChild("Humanoid"):TakeDamage(25)
connection:Disconnect()
DetectBall:Destroy()
end
end)
task.wait(1)
connection:Disconnect()
DetectBall:Destroy()
end)
Now, you can use workspace:GetPartsInPart() if I understand it well and put as a first parameter the detectball, You can add overlapParams if you want but anyways, this will return an array that you can use a for loop to get through every one of the parts.
local parts = workspace:GetPartsInPart(DetectBall)
for _, part in ipairs(parts) do
local humanoid = part.Parent:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid:TakeDamage()--put 4 if r6 or 1.6 if r15
end
end
Never mind, I fixed it, but do you know why this happens?
I have a dummy, and in the dummy’s head there is a health billboard GUI, and I have a local script that, when I click “Y” on the keyboard, will enable the health billboard GUI. and when I click “Y” again, it will disable the health billboard GUI, but the problem is that if the dummy dies and respawns, the script doesn’t enable it again, but when I enable it manually, it works. What is the problem?
Seeing the script making that makes that could be very helpful, but my first thought on this is that the script gets the dummy and it stays like that, never changing dummy when the old dummy dies. Probably not this since I don’t have the script so, again, show me the script.
Yeah nvm, I fixed it. The problem was that the variable turned to nil after the dummy got destroyed, so I just pasted the variable under the function so every time the function is called it will locate the variable again.
btw, do you know how I can make the raycast only the ground because it raycasts the dummy too?
ServerScript:
function RayCastEffect(HRP)
local RayParams = RaycastParams.new()
RayParams.FilterDescendantsInstances = {game.Workspace.Scripts.DebrisFolder}
RayParams.FilterType = Enum.RaycastFilterType.Blacklist
local Angle = 0
for i = 1,30 do
local Size = math.random(2,3)
local Part = Instance.new("Part")
Part.Anchored = true
Part.Size = Vector3.new(1,1,1)
Part.CFrame = HRP.CFrame * CFrame.fromEulerAnglesXYZ(0,math.rad(Angle),0) * CFrame.new(10,5,0)
game.Debris:AddItem(Part,5)
local RayCast = workspace:Raycast(Part.CFrame.p,Part.CFrame.UpVector *- 10, RayParams)
if RayCast then
Part.Position = RayCast.Position + Vector3.new(0,-5,0)
Part.Material = RayCast.Instance.Material
Part.CanCollide = false
Part.CanQuery = false
Part.Color = RayCast.Instance.Color
Part.Size = Vector3.new(Size,Size,Size)
Part.Orientation = Vector3.new(math.random(-180,180),math.random(-180,180),math.random(-180,180))
Part.Parent = game.Workspace.Scripts.DebrisFolder
local Tween = TweenService:Create(Part,TweenInfo.new(.25,Enum.EasingStyle.Bounce,Enum.EasingDirection.InOut),{Position = Part.Position + Vector3.new(0,5,0)}):Play()
delay(1,function()
local Tween = TweenService:Create(Part,TweenInfo.new(1),{Transparency = 1,Position = Part.Position + Vector3.new(0,-5,0)}):Play()
end)
end
Angle += 25
end
end
Store your dummies in a folder, next ignore that folder. Done.
how do I do it?
Like you did with the DebrisFolder
{game.Workspace.Scripts.DebrisFolder, AFolderWhereTheDummiesAre}
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.