#Hello, can someone help me with a script?

1 messages · Page 1 of 1 (latest)

worldly holly
#

Hi, i need to make a part to follow my character (under it) but i need that part to always stay on ground so it needs to follow my character movement but at the same time it needs to stay stick to ground even if i jump or fly that is why i cant use weld or motor i tried doing it with heartbeat but its so slow and not real time what is the easy way for this?

#

it needs to be server script by the way because other players must see that part

worldly holly
# sturdy crow

im not asking for a script i need to learn the method to make the script by myself

#

read my text before replying pls

cerulean turretBOT
#

studio** You are now Level 15! **studio

sturdy crow
worldly holly
sturdy crow
worldly holly
#

i need to clarify

sturdy crow
worldly holly
sturdy crow
worldly holly
#

wouldnt that cause lag if there is multiple players?

sturdy crow
worldly holly
#

im not a pro with remoteevents

worldly holly
worldly holly
#

thanks bro

worldly holly
# sturdy crow

did you get the same errors? it works fine at start but im getting these errors after 20-30 seconds

worldly holly
#

local or server

sturdy crow
#

both

#

@worldly holly

worldly holly
#

1sec i need to translate to english first i was using my language

#

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remote = ReplicatedStorage:WaitForChild("partposevent")

local auras = {}

remote.OnServerEvent:Connect(function(player, pos)
local char = player.Character
if not char then return end

local aura = auras[player]
if not aura then
    aura = ReplicatedStorage:WaitForChild("aura"):Clone()
    aura.Anchored = true
    aura.CanCollide = false
    aura.Parent = workspace
    auras[player] = aura
end

aura.Position = pos

end)

#

this is the server one

#

local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local root = character:WaitForChild("HumanoidRootPart")
local aura = game.Workspace:FindFirstChild("aura")
aura.Anchored = true
aura.CanCollide = false
aura.Parent = workspace

local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Blacklist
params.FilterDescendantsInstances = {character}
local event = ReplicatedStorage:WaitForChild("partposevent")

RunService.RenderStepped:Connect(function()
local origin = root.Position + Vector3.new(0, -2, 0)
local result = workspace:Raycast(origin, Vector3.new(0, -100, 0), params)
if result then
local pos = result.Position + Vector3.new(0, aura.Size.Y/2, 0)
aura.Position = pos
aura.CFrame = CFrame.new(pos) * CFrame.Angles(math.pi/2, 0, 0)
end
end)

local last = 0
RunService.Heartbeat:Connect(function()
if tick() - last < 0.1 then return end
last = tick()
event:FireServer(aura.Position)
end)

cerulean turretBOT
#

studio** You are now Level 7! **studio

worldly holly
#

this is the local

sturdy crow
#

⁨```lua
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remote = ReplicatedStorage:WaitForChild("partposevent")

local auras = {}

remote.OnServerEvent:Connect(function(player, pos)
local char = player.Character
if not char then return end

local aura = auras[player]
if not aura then
    aura = ReplicatedStorage:WaitForChild("aura"):Clone()
    aura.Anchored = true
    aura.CanCollide = false
    aura.Parent = workspace
    auras[player] = aura
end

aura.Position = pos

end)

#

⁨```lua
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local root = character:WaitForChild("HumanoidRootPart")
local aura = game.Workspace:FindFirstChild("aura")
aura.Anchored = true
aura.CanCollide = false
aura.Parent = workspace

local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Blacklist
params.FilterDescendantsInstances = {character}
local event = ReplicatedStorage:WaitForChild("partposevent")

RunService.RenderStepped:Connect(function()
local origin = root.Position + Vector3.new(0, -2, 0)
local result = workspace:Raycast(origin, Vector3.new(0, -100, 0), params)
if result then
local pos = result.Position + Vector3.new(0, aura.Size.Y/2, 0)
aura.Position = pos
aura.CFrame = CFrame.new(pos) * CFrame.Angles(math.pi/2, 0, 0)
end
end)

local last = 0
RunService.Heartbeat:Connect(function()
if tick() - last < 0.1 then return end
last = tick()
event:FireServer(aura.Position)
end)

worldly holly
#

i get more errors if i try to lower the remoteevent ms

sturdy crow
worldly holly
#

yea i dont know about positions and predictions

sturdy crow
worldly holly
sturdy crow
worldly holly
sturdy crow
worldly holly
#

okay

sturdy crow
#

This error means client tries to fire event, but no server script was actively listening to it

#

I replicated ur scripts in my game and they are working

worldly holly
#

Oh i think its working ill try to lower the latency

#

yea it works now i think ill try to make it smoother