Activate PlatformStanding through Ontouched

I am trying to make a Block where if I touch it, It makes the player that touched it Enable PlatformStanding property. I have made a script but it does not work. (P.S the script is inside a LocalScript Inside of a tool. I want it so if the player is somebody with the tool it enables PlatformStanding.) Here is the script:

local tool = script.Parent

local Player = game.Players.LocalPlayer
local character = Player.Character or Player.CharacterAdded:Wait()
local humanoid = hit.Parent:FindFirstChild("Humanoid")
local debounce = false

Player.CharacterAdded:Connect(function(char)
	character = char
	humanoid = character:WaitForChild("Humanoid")
end)

tool.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if not debounce then
			debounce = true
			humanoid.PlatformStand = true
			wait(5)
			humanoid.PlatformStand = false
			debounce = false
		end
			
	end
end)

I removed body impulse cuz I forgot that i just want the player to fall

you’re only checking to make sure the touching part belongs to a character. If it does then you’re flinging the local character backwards, regardless of which character actually touched the part.

2 Likes

I had forgotten that I just wanted the player to Fall after touching the part.

if you’re going to keep this logic on the client; filter out characters that aren’t the local character

	if hit.Parent:FindFirstChild("Humanoid") and hit.Parent == character then

You’re changes will only apply on the client if you use a local script. I suggest using a server script

No; client physics updates will pass the replication filter when they’re made on assemblies that have network ownership assigned to them. A client always has network ownership over it’s own character.

It still doesnt work. I changed it to that and remove a variable I didnt use

debug it. add prints all over and see where it breaks. make sure the variables print to the values you expect them to be.

it just doesnt print anything. Does not even reach the TouchedEvent

local humanoid = hit.Parent:FindFirstChild("Humanoid"). You have this line at the top of your script but hit is not defined so it will error.

Touched is an event of parts. Tools dont have a touched event. Did you mean Tool.Handle by chance? Atm the only character it can update is the local character, but I’m guessing youd like it to fling other characters when you run up and touch them with it. You’re going to need to move it to a server script for that, and change the filter to only work for hit.Parents that dont equal this character (if hit.Parent:FindFirstChild("Humanoid") and hit.Parent ~= character then)

1 Like

I replaced it local humanoid = character:WaitForChild(“Humanoid”)

also quick question Ive seen people make it when PlatformStanding is turned on the player ragdolls. Ive tried but it does not work. I just wanted to know how it works

You have to replace the rig’s motor6d’s with ballsocketconstraints. It’s kinda complex; try searching around devforum/freemodels for a module that can make the ragdoll for you.

But how can I search it because most of them are StarterCharacterScripts that enable On death

What triggers them isnt the bit you need. Youd want to extract out their ragdoll creation logic and call it in your Touched event instead of Died

1 Like

I found a module that works and I’m gonna test it thanks

1 Like