What could be causing the Player to Float?
Here is the code
local Spawned = script:WaitForChild("Spawned")
local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local SnowballFolder = workspace.Snowballs
local Debris = game:GetService("Debris")
local humanoid = char:WaitForChild("Humanoid")
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.F then
if Spawned.Value == false then
local Snowball = game.ReplicatedStorage.Props.Snowball
Snowball = Snowball:Clone()
Snowball.Size = Vector3.new(1,1,1)
Snowball.Parent = SnowballFolder
Snowball.Name = plr.Name.."'s Snowball"
Spawned.Value = true
local offset = Vector3.new(0,0,-5) -- in your case, Vector3.new(0,0,5), or something like that
Snowball.CFrame = char.HumanoidRootPart.CFrame*CFrame.new(offset) -- should offset while keeping rotations of root.CFrame
task.wait(0.1)
local weldconst = Instance.new("WeldConstraint")
weldconst.Parent = Snowball
weldconst.Part0 = Snowball
weldconst.Part1 = char.HumanoidRootPart
humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(function()
if humanoid.FloorMaterial == Enum.Material.Snow then
warn("Position Changed")
Snowball.Size = Snowball.Size + Vector3.new(0.1,0.1,0.1)
Snowball.CFrame = Snowball.CFrame * CFrame.new(offset)
else
warn("Player Not on Assigned Material ( Snow )")
end
end)
else
warn("Snowball already Spawned Releasing into Wild")
local Snowball = SnowballFolder:FindFirstChild(plr.Name.."'s Snowball")
Snowball:FindFirstChild("WeldConstraint"):Destroy()
Debris:AddItem(Snowball,5)
Spawned.Value = false
end
end
end)
