So i’m working on a little project called rope ragdoll and I’ve made it so whenever you click somewhere on a part, you are able to ragdoll and get attached to the place you’ve clicked on.
The problem I’m having is that I added a pizza giver tool, which I’d like to use however, when using the tool, depending on whever you clicked, you get roped onto the area you’ve clicked at.
Not only that, even when clicking on the clickdetector causes you to be roped at the place you’ve clicked at too.
Basically, I’d like a way to prevent have the player become roped and ragdolled when clicking on a clickdetector or using a tool.
Here’s the script for the mouseclick
local target = Mouse.Target
local pos = Mouse.Hit
if Player.Character.Humanoid.Health ~= 0 and Player:DistanceFromCharacter(pos.Position) < 25 then
game.ReplicatedStorage.delRope:FireServer()
game.ReplicatedStorage.addRope:FireServer(pos, target)
game.ReplicatedStorage.Ragdoll:FireServer()
end
end)
repeat wait() until script.Parent.Parent:IsA("Player")
local Player = script.Parent.Parent
local Mouse = Player:GetMouse()
Mouse.Button1Down:Connect(function()
local target = Mouse.Target
local pos = Mouse.Hit
if Player.Character.Humanoid.Health ~= 0 and Player:DistanceFromCharacter(pos.Position) < 25 then
game.ReplicatedStorage.delRope:FireServer()
game.ReplicatedStorage.addRope:FireServer(pos, target)
game.ReplicatedStorage.Ragdoll:FireServer()
end
end)
no, no errors, the problem is that whenever i click using a tool or click on a clickdetector, it ropes and ragdolls me, i’d like for it not to do that since it’s quite annoying
local target = Mouse.Target
local pos = Mouse.Hit
if Player.Character:FindFirstChildOfClass('Tool') or Mouse.Target:IsA('ClickDetector') then return end
if Player.Character.Humanoid.Health ~= 0 and Player:DistanceFromCharacter(pos.Position) < 25 then
game.ReplicatedStorage.delRope:FireServer()
game.ReplicatedStorage.addRope:FireServer(pos, target)
game.ReplicatedStorage.Ragdoll:FireServer()
end
end)
that worked, just had to change the bit for when you click on the clickdetector
Mouse.Button1Down:Connect(function()
local target = Mouse.Target
local pos = Mouse.Hit
if Player.Character:FindFirstChildOfClass('Tool') or Mouse.Target:FindFirstChildOfClass("ClickDetector") then return end
if Player.Character.Humanoid.Health ~= 0 and Player:DistanceFromCharacter(pos.Position) < 25 then
game.ReplicatedStorage.delRope:FireServer()
game.ReplicatedStorage.addRope:FireServer(pos, target)
game.ReplicatedStorage.Ragdoll:FireServer()
end
end)