I have a game where the Character can climb on every wall. To achieve this, I move a small trusspart to the front of the character when it raycasts something in front. This was working until some days ago, then stopped working for no reason. Wtf is happening?
This is a photo of how it should work in server, but only happens in studio:
I have tried putting a normal trusspart free in workspace and the character climbed it with no problems, only this one I create does not work.
Also, the trusspart exist only in client.
Here is the code:
local Players = game.Players
local Player = Players.LocalPlayer
local Character = Player.Character
local Root = Character:WaitForChild("HumanoidRootPart")
local nilPos = Vector3.new(0,10000000000000,0)
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {script.Parent, workspace.MouseIgnore}
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local truss = Instance.new("TrussPart")
truss.Anchored = true
truss.Position = nilPos
truss.Transparency = 0.5
truss.CanCollide = true
truss.Parent = workspace.MouseIgnore
spawn(function()
while true do
wait()
local raycastResult = workspace:Raycast(Root.Position, Root.CFrame.LookVector*2, raycastParams)
if raycastResult then
if raycastResult.Instance.Transparency == 0 then
truss.Position = raycastResult.Position
end
end
end
end)