Can’t you just set the Parts you want to collide/non-collide on the client side…? A LocalScript
is used for the client view only, which can make certain players go through parts, while others can’t depending on the scenario
I need the player to walk basically through every wall in the world except the ground, it would be too much trouble to uncollide every part in the world and toggle that
Yes, localscripts would be the ideal, but as i said
Put this in a local scrip which will be inside a click detectort:
local myPart = PATHHERE
script.Parent.MouseClick:Connect(function()
myPart.CanCollide = not myPart.CanCollide
end)
Button or UIS, i’m still deciding on that.
Just make two collision group,“Floor” and “Player”. And set Floor to collide with Player but not Default. Then set Player to not collide with Default. And to toggle the player collision, just do
PhysicsService:CollisionGroupSetCollidable("Player", "Default", toggleBoolean)
Basically i need a script to make a player able to run through walls when wanted.
Yes collisions groups are your go to thing then Collision Filtering | Roblox Creator Documentation
You could maybe put all the parts that are WallParts in a Folder
, and again using a LocalScript
, get the children of all parts inside that said “Folder”, which would make all of the walls collision set to false/true
(Just noticed the other posts)
local WallParts = workspace.CollidedWalls
local ColissionButton = script.Parent
local NonColissionButton = script.Parent.OtherButton
ColissionButton.MouseButton1Down:Connect(function()
for _, Part in pairs(WallParts:GetChildren()) do
Part.CanCollide = true
end
end)
NonColissionButton.MouseButton1Down:Connect(function()
for _, Part in pairs(WallParts:GetChildren()) do
Part.CanCollide = false
end
end
Thanks a lot!
Aditionally, do you have a quick idea on how i can make the player vibrate?
Just go left and right continuously.
I’m sorry wot
I don’t believe you worded that right, what would you mean by vibrating? Like slightly changing the character’s orientation?
I mean just making the player vibrate, shake, something like that.
Just making it vibrate left and right, i’m sorry i can’t figure out another way of describing it
Maybe what you could use is a RunService Heartbeat
event, which would barely move the Charcter but also result in a somewhat shaking way?
local Character = --I guess define your Character here
local RunService = game:GetService("RunService")
local HRP = Character:WaitForChild("HumanoidRootPart")
RunService.Heartbeat:Connect(function()
HRP.Position += Vector3.new(math.random(-1000, 1000) * 0.0001, 0, math.random(-1000, 1000 * 0.0001))
end)
I’m actually a bit stumped on how you could implement this
I’ll try it out, also how do i make it stop?
Edit: I think you may have made it a litte extra because when i tried it out i just teleported to the void.
I guess just put a return to stop the function
You could set a Connection
variable to detect when you want it to stop shaking your character, I believe you could do it like this
local Character = --I guess define your Character here
local RunService = game:GetService("RunService")
local HRP = Character:WaitForChild("HumanoidRootPart")
local Connection
local RandomBoolCheck = --You'd need to implement some sanity check I presume
local function ShakeCharacter()
HRP.Position += Vector3.new(math.random(-1000, 1000) * 0.000001, 0, math.random(-1000, 1000 * 0.000001))
if RandomBoolCheck.Value == true then
Connection:Disconnect()
end
end)
Connection = RunService.Heartbeat:Connect(ShakeCharacter)
Not sure though
This is the script i’m using so far:
local WallParts = workspace.Pillar
local ColissionButton = script.Parent
local Collided = false
local Character = game.Players.LocalPlayer.Character
local RunService = game:GetService("RunService")
local HRP = Character:WaitForChild("HumanoidRootPart")
ColissionButton.MouseButton1Down:Connect(function()
if Collided == false then
Collided = true
for _, Part in pairs(WallParts:GetChildren()) do
Part.CanCollide = false
end
RunService.Heartbeat:Connect(function()
HRP.Position += Vector3.new(math.random(-100, 100) * 0.0001, 0, math.random(-100, 100 * 0.0001))
end)
elseif Collided == true then
Collided = false
for _, Part in pairs(WallParts:GetChildren()) do
Part.CanCollide = true
end
end
end)
Edit: Do you know how i can implement it?
Maybe this?
local WallParts = workspace.Pillar
local ColissionButton = script.Parent
local Collided = false
local Character = game.Players.LocalPlayer.Character
local RunService = game:GetService("RunService")
local HRP = Character:WaitForChild("HumanoidRootPart")
ColissionButton.MouseButton1Down:Connect(function()
local Connection
if Collided == false then
Collided = true
for _, Part in pairs(WallParts:GetChildren()) do
Part.CanCollide = false
end
local function ShakeCharacter()
HRP.Position += Vector3.new(math.random(-100, 100) * 0.00001, 0, math.random(-100, 100 * 0.00001))
end
Connection = RunService.Heartbeat:Connect(ShakeCharacter)
elseif Collided == true then
Collided = false
Connection:Disconnect()
for _, Part in pairs(WallParts:GetChildren()) do
Part.CanCollide = true
end
end
end)
No clue
No problem, you already helped me with my main problem.
I really appreciate you helping me yesterday and today, and also all the other people i’ve seen you helping while helping me.
Thanks for everything tho.