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

How do I make players float in bricks?

Asked by
DollorLua 235 Moderation Voter
5 years ago

I was trying to make a different version of FE2, might want to check it out, and i tried to make players float in the water. I have a script in StarterCharacterScripts and inside it has a Water.Touched function and a Water.TouchEnded function as seen here:

head.Touched:connect(function(hit)
    if hit:FindFirstChild('_Water') then
    print('Hit By Water!')
    TouchingWater = true
    CurrentWater = hit
    WaterState = hit.State.Value
    local bodyforce = Instance.new("BodyForce")
    bodyforce.Parent = head.Parent.HumanoidRootPart
    bodyforce.Name = 'BodyForce'
    bodyforce.Force = Vector3.new(0, 20000, 0)
    end
    end)
    head.TouchEnded:connect(function(hit)
    if hit:FindFirstChild('_Water') then
    if head.Position.Y > hit.Position.Y then
    TouchingWater = false
    CurrentWater = nil
    WaterState = 'Water'
    head.Parent.HumanoidRootPart.BodyForce:Destroy()
    end
    end
    end)

It does create the bodyforce however it only moves the player up when they jump. I don't know how to fix or change this and yes theres another one that said the same thing from 4 years ago. I have tried using workspace. Gravity but i couldn't get it to work right. If I should use workspace.Gravity show me a example of how it would work. This is in a normal script not a local script.

0
DollorMan this is not an answer, Just asking you, For how much time you've been learning to reach this level of scripting and, How did u learn? Zero_Tsou 175 — 5y
0
I actually learned how to script mainly by guessing what might work and using the dev wiki if it doesn't (https://developer.roblox.com) DollorLua 235 — 5y
0
maybe if u use the Humanoid.HipHeight. NickAtNick 163 — 5y
0
btw TouchEnded is very glitchy, I would recommend Region3 NickAtNick 163 — 5y
0
I have the Region3 module script by egomoose in use but i dont want to reset the region every milisecond DollorLua 235 — 5y

Answer this question