Hi can someone help me with this script

Ohhh shoot I misspelled it lol, it’s GetPropertyChangedSignal not what I typed at first (GetPropertySignalChanged)

|| Will be awaiting a response ||

It doesnt work should the code look like this?

character.HumanoidRootPart:GetPropertyChangedSignal("Position"):Connect(function()
		
	
-- check distance

if (character.HumanoidRootPart.Position - workspace.Ball.Position).Magnitude < 4 then
			game:GetService("ReplicatedStorage"):FindFirstChild("RemoteEvent"):FireServer(game.Workspace.Ball)

			local F = Instance.new("BodyVelocity") -- Creates a Force
			F.P = 9
			F.Parent = game.Workspace.Ball -- Makes the force act on the ball
			F.Name = script.Name -- Make the force's name the script's name
			F.velocity = character.HumanoidRootPart.CFrame.lookVector * Power + Vector3.new(0,Power - 40,0)  -- The force is where the Right Leg is looking (so if your right leg was looking towards the goal then the ball would go to the goal) and its given a certain value to go against (the higher the number, the faster the ball would go)


			F.maxForce = Vector3.new(math.huge,math.huge,math.huge) -- The maximum force it's allowed to give the ball 
			game.Debris:AddItem(F,0.3) -- This destroys the Force within 0.3 seconds without stopping the code so it doesn't keep the ball moving



		end 
			
		end)
end)

		
		
	



Maybe try putting some print statements and see which ones fire, if that doesn’t work, I’ll overlook the code again.

character.HumanoidRootPart:GetPropertyChangedSignal(“Position”):Connect(function()
Its that line i put print (“Moved”) And it didnt work

I get no errors here either. (dsadasd)

Hmm, maybe try changing the GetPropertySignalChanged line to this:

Humanoid:GetPropertySignalChanged(“MoveDirection”):Connect(function()
yeah code
end)

Ok it works now how can i discconnect the signal after 0.4 seconds now.

uhhhh probably could use return RbxScriptSignal:Disconnect() like this (also modify the line again):

local Service
Service = Humanoid:GetPropertySignalChanged(“MoveDirection”):Connect(function()

task.spawn(function() -- older version: spawn(function()
task.wait(0.4) -- older version: wait(interval)
Service:Disconnect()
end)

end)

Will be awaiting your next / final (hopefully) response :crossed_fingers:

Bit of a problem if you stand still you cant kick the ball.

:grimacing: that’s kind of the setback because the event only fires when the player moves…

Would runservice work or would it not…

It would… it would (accidentally typed “it would” twice lol) just be way more laggy

Erm i used run service and im just getting tons of errors saying attpemt to call a nil value

Nvm i forgot to put function at the end of runservice :face_with_raised_eyebrow:

1 Like

Thank you very much its now working

1 Like

Ill make you as the solution thanks.

1 Like

Just make sure it doesn’t run for too long or you’re gonna lag like a lot

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.