BodyForces not working

I’m trying to make a snowboarding game and now I’m on the part of making the snowboard move and for some reason when I press w the board doesn’t move!

First I use the UserInput service as a local script to change a part’s transparency (This script works just fine!)

local UserInputService = game:GetService('UserInputService')
local MovementControl = game.Workspace.DevSnowboard.MovementControl
local BodyForceController = game.Workspace.DevSnowboard.BodyForceController

local function Movement()
if MovementControl.Transparency == 0 then
		print"Movement for snowboard is now active"
end
UserInputService.InputBegan:Connect(function(input,gameProccesedEvent)
		if input.KeyCode == Enum.KeyCode.W then
		print"Pressed w"
		BodyForceController.Transparency = 0
	end
  end)
end

MovementControl:GetPropertyChangedSignal("Transparency"):Connect(Movement)

Then I use the body force script this is the script that is not working!

local BodyForce = script.Parent
local BodyForceController = script.Parent.Parent.Parent.BodyForceController

game.Workspace.DevSnowboard.Front:WaitForChild("BodyForce")
game.Workspace.DevSnowboard:WaitForChild("BodyForceController")
game.Workspace.DevSnowboard:WaitForChild("MovementControl")

while true do
	wait()
if BodyForceController.Transparency == 0 then
while true do
	wait()
print("Updating body force")
BodyForce.Force = BodyForce.Force + Vector3.new(10,0,0)
    end
  end
end

Video clip
https://gyazo.com/c2a7eb759987d18894e15361a81f9539

1 Like

im not good with body force but try this

local BodyForce = script.Parent
local BodyForceController = script.Parent.Parent.Parent.BodyForceController

game.Workspace.DevSnowboard.Front:WaitForChild("BodyForce")
game.Workspace.DevSnowboard:WaitForChild("BodyForceController")
game.Workspace.DevSnowboard:WaitForChild("MovementControl")

while true do
	wait()
if BodyForceController.Transparency == 0 then
while true do
	wait()
print("Updating body force")
BodyForce.Force = BodyForce.Force*Vector3.new(10,0,0)
    end
  end
end

instead of adding the vector try multiply?

1 Like

Still did not work I tried adding print functions to see if the script even worked. Here is the result

local BodyForce = script.Parent
local BodyForceController = script.Parent.Parent.Parent.BodyForceController

game.Workspace.DevSnowboard.Front:WaitForChild("BodyForce")
game.Workspace.DevSnowboard:WaitForChild("BodyForceController")
game.Workspace.DevSnowboard:WaitForChild("MovementControl")

while true do
	wait()
	if BodyForceController.Transparency == 0 then
		while true do
			wait()
			print("Updating body force")
			BodyForce.Force = BodyForce.Force*Vector3.new(10,0,0)
		end
		else print"BFC is not running"
	end
end

and I got this in Output
image

1 Like
local BodyForce = script.Parent
local BodyForceController = script.Parent.Parent.Parent.BodyForceController

game.Workspace.DevSnowboard.Front:WaitForChild("BodyForce")
game.Workspace.DevSnowboard:WaitForChild("BodyForceController")
game.Workspace.DevSnowboard:WaitForChild("MovementControl")

while true do
	wait()
	if BodyForceController.Transparency == 0 then
		print("Updating body force")
		BodyForce.Force = BodyForce.Force*Vector3.new(10,0,0)
	else 
 		print ("BFC is not running")
	end
end

try this

My output still gets filled with “BFC is not running”
image
As you can see in the image the UserInput worked just fine

1 Like
game.Workspace.DevSnowboard.Front:WaitForChild("BodyForce")
game.Workspace.DevSnowboard:WaitForChild("BodyForceController")
game.Workspace.DevSnowboard:WaitForChild("MovementControl")

what are these for??

They are to make sure those objects are fully loaded in

1 Like

you should put them at the top of the script before the local body force and are these two scripts different?

What do you mean? and I put the “WaitForChild” functions at the top now, same result.
image

1 Like

there is another way better to do is fire a remote event rather than changing a part transparency

1 Like

I don’t really know how to do that lol so that’s why I’ve been using part transparency to determine.
And the wiki for the remote events is confusing for me

watch alvinbloxs tutorial its very easy fo learn from him

Alright, I’ll go watch it thank you for your time I’ll update you on how it goes! :smiley:

1 Like

Is your second script a LocalScript or Script?

1 Like

The bodyforce script is a script image

1 Like

he told the second one is server i think

UserInput is a local script image

1 Like

gameProccesedEvent

what is this parameter

2 Likes

oh ok i understand it now thanks