Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is the belt not being welded to the player?

Asked by 5 years ago

The belt just spawns in and gets flicked away, i'm guessing it flicks like that because it was inside of another touchable part and not welded to it.

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local LobbyBelt = ReplicatedStorage.LobbyBelt

Players.PlayerAdded:Connect(function(Player)
    local Character = Player.Character or Player.CharacterAdded:wait()
    local Belt = LobbyBelt:Clone()
    Belt.Parent = Character
    Belt.CFrame = Character.LowerTorso.CFrame
    local Weld = Instance.new("ManualWeld")
    Weld.Parent = Belt
    Weld.Part0 = Belt
    Weld.Part1 = Character.LowerTorso
    Weld.C0 = CFrame.new(0, 0, 0)
    print("Player Equipped the Lobby Belt")
end)

2 answers

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local LobbyBelt = ReplicatedStorage.LobbyBelt

Players.PlayerAdded:Connect(function(Player)
    local Character = Player.Character or Player.CharacterAdded:wait()
    local Belt = LobbyBelt:Clone()
    Belt.Parent = Character
    Belt.CFrame = CFrame.new(Character.LowerTorso.Position)--changes the position of the belt to the players lower torso
    local Weld = Instance.new("Weld")--makes a working weld, sticks to the player
    Weld.Parent = Belt
    Weld.Part0 = Belt
    Weld.Part1 = Character.LowerTorso
    print("Player Equipped the Lobby Belt")
end)

u dont need the co part of the weld and the rest of the script is urs for any moderator out there, dont downvote me ps. if this works as i belive it will cause i tested it out to be sure then pls upvote

0
also u need to update the Belt.CFrame constantly otherwise it wont follow the player Gameplayer365247v2 1055 — 5y
0
Great now the belt just falls straight through the floor. songboy50 77 — 5y
0
The flinging away isn't the issue, the flinging away is just a result. A result of the Belt somehow not getting welded. And like my question asks I'm looking for a way to fix the weld. songboy50 77 — 5y
0
CFrame is used to change the position of something, it doesnt hold any numbers but it needs numbers to put whatever u wanna change the location of to that location Gameplayer365247v2 1055 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

I solved it by instead of using

Character.LowerTorso

I used

game.Workspace:WaitForChild(Player.Name):WaitForChild("LowerTorso")

Cause finding the Character like this is always an alternative for me with confusing issues like this.

Answer this question