i am just wondering if there’s a way cuz i havent seen any vids on how to make any part turn players into R6 when touched, i dont know scripting much and i only understand how they work i guess when i read them only.
i want the player to become R6 when they touch the part but when they leave they go back to R15 because my game is R15 only
my issue is that there’s nothing online that can help me achieve it
so far i tried asking ChatGPT for help but sadly failed
This is the Server Script that chat GPT gaved me
-- Server Script
local function onTouch(hit)
local character = hit.Parent
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid.WalkSpeed = 0 -- Stop the player from moving while transforming
-- You can add more customization here if needed
wait(1) -- Simulate transformation time (adjust as needed)
humanoid.WalkSpeed = 16 -- Reset walk speed after transformation
end
end
-- Create a part that the player needs to touch for transformation
local transformPart = Instance.new("Part")
transformPart.Size = Vector3.new(10, 5, 10) -- Customize the size as needed
transformPart.Position = Vector3.new(0, 5, 0) -- Customize the position as needed
transformPart.Touched:Connect(onTouch)
transformPart.Parent = game.Workspace
this one is an other type that is supposed to be the startplayer ?
-- LocalScript
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local function onEnter()
-- You may want to add additional checks here to ensure the player only transforms once
humanoid:Move(Vector3.new(0, 5, 0)) -- Adjust the position if needed
-- Add any additional customization for the R6 mode here
character.HumanoidRigType = Enum.HumanoidRigType.R6
end
local function onExit()
humanoid:Move(Vector3.new(0, -5, 0)) -- Adjust the position if needed
-- Add any additional customization for the regular mode here
character.HumanoidRigType = Enum.HumanoidRigType.R15
end
-- Adjust the part name based on your setup
local transformPart = game.Workspace:WaitForChild("Part")
transformPart.Touched:Connect(onEnter)
transformPart.TouchEnded:Connect(onExit)
This is My first post soo it’s a bit normal if i have some errors or issues with some things.
Try this
(r6 version of this script would be parented to the part you want, and the part beneath it/surrounding it could have the r15 version)
local Players = game:GetService("Players") --Get Players
local Busy = false --Used to prevent script from running multiple times on one player
local RigType = Enum.HumanoidRigType.R6 --Type of character to make
script.Parent.Touched:Connect(function(TouchPart: BasePart) --Connect touched event to function
if not Busy then --Check if busy
Busy = true
local Player = Players:GetPlayerFromCharacter(TouchPart.Parent) --Grab player
if Player then --Check if player exists
if TouchPart.Parent.Humanoid.RigType ~= RigType then --Check to make sure player character isn't already the rigtype
task.wait(0.25) --Wait to make sure the CFrame grabbed is actually on the platform
local OldCFrame = TouchPart.Parent:GetPivot() --Get currnet character's CFrame (position data)
--Create new character model in R6
local HD = TouchPart.Parent.Humanoid:GetAppliedDescription()
local NewCharacter = Players:CreateHumanoidModelFromDescription(HD, RigType, Enum.AssetTypeVerification.Always)
NewCharacter.Humanoid.DisplayName = Player.DisplayName
NewCharacter.Name = Player.Name
--Change player's character into the new one
Player.Character:Destroy()
Player.Character = NewCharacter
NewCharacter:PivotTo(OldCFrame)
NewCharacter.Parent = workspace
end
end
task.wait()
Busy = false
end
end)
it works, but what if when you leave u get R6 removed and u go back to like idk to like R15 cuz the game is only R15 (ima also try it if it works for ragdoll bc my game is a ragdoll game or smth)
TOught so, i’ll do that and the script is very simple to understand too i really like it, i’ll test smth cuz i kinda wanna make areas that when u enter u become R6 and it gives you certain weapons.
i well kinda asked chatGpt to make the script give a sword when the part is touched and also remove every items from the inventory and when u leave the part you loose the sword and get ur stuff back but the Ai Going Wildd or what iff i just make an other part that makes u R15 and when u touch that part u get the sword removed and get ur items back uh
local Players = game:GetService(“Players”)
local replicatedStorage = game:GetService(“ReplicatedStorage”)
local swordTemplate = replicatedStorage:WaitForChild(“SwordTemplate”) – Assuming you have a sword template in ReplicatedStorage
local Busy = false
local RigType = Enum.HumanoidRigType.R6
script.Parent.Touched:Connect(function(TouchPart)
if not Busy then
Busy = true
local Player = Players:GetPlayerFromCharacter(TouchPart.Parent)
if Player then
if TouchPart.Parent.Humanoid.RigType ~= RigType then
task.wait(0.25)
local OldCFrame = TouchPart.Parent:GetPivot()
-- Remove all items from the player's backpack
for _, item in pairs(Player.Backpack:GetChildren()) do
item:Destroy()
end
-- Create a new sword and put it in the player's backpack
local newSword = swordTemplate:Clone()
newSword.Parent = Player.Backpack
local HD = TouchPart.Parent.Humanoid:GetAppliedDescription()
local NewCharacter = Players:CreateHumanoidModelFromDescription(HD, RigType, Enum.AssetTypeVerification.Always)
NewCharacter.Humanoid.DisplayName = Player.DisplayName
NewCharacter.Name = Player.Name
Player.Character:Destroy()
Player.Character = NewCharacter
NewCharacter:PivotTo(OldCFrame)
NewCharacter.Parent = workspace
end
end
task.wait()
Busy = false
end
end)
script.Parent.TouchEnded:Connect(function(TouchPart)
local Player = Players:GetPlayerFromCharacter(TouchPart.Parent)
if Player then
– Remove the sword from the player’s backpack
for _, item in pairs(Player.Backpack:GetChildren()) do
if item.Name == “Sword” then
item:Destroy()
end
end
-- Restore the original items to the player's backpack (customize as needed)
-- Example: You might have a function to give the player their default items
-- RestoreDefaultItems(Player)
end
local Players = game:GetService("Players") --Get Players
local Busy = false --Used to prevent script from running multiple times on one player
local RigType = Enum.HumanoidRigType.R6 --Type of character to make
local Rigs = {}
--When a player joins adds a version of their avatar as the specified RigType (for faster loading)
game.Players.PlayerAdded:Connect(function(Player: Player)
Player.CharacterAppearanceLoaded:Wait()
--Create new character model in R6
local HD = Player.Character.Humanoid:GetAppliedDescription()
local NewCharacter = Players:CreateHumanoidModelFromDescription(HD, RigType, Enum.AssetTypeVerification.Always)
NewCharacter.Humanoid.DisplayName = Player.DisplayName
NewCharacter.Name = Player.Name
Rigs[Player.UserId] = NewCharacter
end)
script.Parent.Touched:Connect(function(TouchPart: BasePart) --Connect touched event to function
if not Busy then --Check if busy
Busy = true
local Player = Players:GetPlayerFromCharacter(TouchPart.Parent) --Grab player
if Player then --Check if player exists
if TouchPart.Parent.Humanoid.RigType ~= RigType then --Check to make sure player character isn't already the rigtype
task.wait(0.25) --Wait to make sure the CFrame grabbed is actually on the platform
local OldCFrame = TouchPart.Parent:GetPivot() --Get currnet character's CFrame (position data)
--Change player's character into the new one
local NewCharacter = Rigs[Player.UserId]:Clone()
Player.Character:Destroy()
Player.Character = NewCharacter
NewCharacter:PivotTo(OldCFrame)
NewCharacter.Parent = workspace
end
end
task.wait()
Busy = false
end
end)
--Script under part that gives sword and stuff
local Players = game:GetService("Players") --Get Players
local Tools = { --Tools to give player when the part is touched
[1] = workspace.Wherever_Your_Tool_Is;
[2] = workspace.Wherever_Your_Tool_Is;
}
local Busy = false --Used to keep the script from running multiple times for one player
script.Parent.Touched:Connect(function(TouchPart: BasePart) --Connect touched event to a function
if not Busy then --Check to make sure not busy
Busy = true
local Player = Players:GetPlayerFromCharacter(TouchPart.Parent) --Get player from character model (if they exist)
if Player then --Check to make sure player exists
Player.Character.Humanoid:UnequipTools() --Unequip tools to have them all in the backpack
--Make folder storing player's tools parent under the script
local ToolStorage = Instance.new("Folder")
ToolStorage.Name = Player.UserId
ToolStorage.Parent = script
task.wait() --Wait to give the server enough time to unequip said tools
--Parent player's tools to said folder
for _, v in pairs(Player.Backpack:GetChildren()) do
v.Parent = ToolStorage
end
--Parent clones of tools specified in Tools to the player's backpack
for _, v in pairs(Tools) do
v:Clone().Parent = Player.Backpack
end
end
task.wait()
Busy = false
end
end)
--Script to gives the player back their original tools
local Players = game:GetService("Players") --Get Players
local Busy = false --Used to keep the script from running multiple times for one player
script.Parent.Touched:Connect(function(TouchPart: BasePart) --Connect touched event to a function
if not Busy then --Check to make sure not busy
Busy = true
local Player = Players:GetPlayerFromCharacter(TouchPart.Parent) --Get player from character model (if they exist)
if Player then --Check to make sure player exists
if script:FindFirstChild(Player.UserId) then --Check if player actually has tools stored in a folder
Player.Character.Humanoid:UnequipTools() --Unequip tools to have them all in the backpack
--Destroy tools in player's backpack
for _, v in pairs(Player.Backpack:GetChildren()) do
v:Destroy()
end
--Restore old tools to player's backpack
for _, v in pairs(script:FindFirstChild(Player.UserId):GetChildren()) do
v.Parent = Player.Backpack
end
end
end
task.wait()
Busy = false
end
end)
do i have to put the script in the part ? for the tool and for the other one i should do the same right ?
i think i forgot to add a Tool Folder in workspace or something
The scripts will need to be parented to an object that has a Touched Event (all parts have this)
And for the tools you can put them anywhere but you need to tell the script where they are
So if I have a tool in a folder in workspace called “Tools”, it would be setup like this:
i dont know why but the script does remove all my tools and gives me the sword but it doesnt make me have the sword be in my hands when i equip it and all my tools gets scatered everywhere in the map, i also put the folder in replicatedstorage and now Uhhmmm the script is Going wildd
I have no way to get to your discord, you don’t have it listed anywhere and your group’s discord invite is invalid/expired
Here’s the updated scripts:
--Script under part that gives sword and stuff
local Players = game:GetService("Players") --Get Players
local ServerStorage = game:GetService("ServerStorage") --Get Server Storage
local StorageFolder = ServerStorage
local Tools = { --Tools to give player when the part is touched
[1] = workspace.Wherever_This_Tool_Is;
}
local Busy = false --Used to keep the script from running multiple times for one player
local EffectedPlayers = {} --Table to keep track of effected players
script.Parent.Touched:Connect(function(TouchPart: BasePart) --Connect touched event to a function
if not Busy then --Check to make sure not busy
Busy = true
local Player = Players:GetPlayerFromCharacter(TouchPart.Parent) --Get player from character model (if they exist)
if Player and not table.find(EffectedPlayers, Player) then --Check to make sure player exists and hasn't been effected
Player.Character.Humanoid:UnequipTools() --Unequip tools to have them all in the backpack
--Make folder storing player's tools parent under StorageFolder
local ToolStorage = Instance.new("Folder")
ToolStorage.Name = Player.UserId
ToolStorage.Parent = StorageFolder
task.wait() --Wait to give the server enough time to unequip said tools
--Parent player's tools to said folder
for _, v: Tool in pairs(Player.Backpack:GetChildren()) do
v.Parent = ToolStorage
v.Handle.CFrame = CFrame.new(Vector3.new(0, 9999, 0))
v.Handle.Anchored = true
end
--Parent clones of tools specified in Tools to the player's backpack
for _, v in pairs(Tools) do
v:Clone().Parent = Player.Backpack
end
table.insert(EffectedPlayers, Player) --Add player to list of effected players
coroutine.wrap(function() --Remove player from effected players when their folder is being removed
StorageFolder:FindFirstChild(Player.UserId).Destroying:Wait()
table.remove(EffectedPlayers, table.find(EffectedPlayers, Player))
end)()
end
task.wait()
Busy = false
end
end)
--Script to gives the player back their original tools
local Players = game:GetService("Players") --Get Players
local ServerStorage = game:GetService("ServerStorage") --Get Server Storage
local StorageFolder = ServerStorage
local Busy = false --Used to keep the script from running multiple times for one player
script.Parent.Touched:Connect(function(TouchPart: BasePart) --Connect touched event to a function
if not Busy then --Check to make sure not busy
Busy = true
local Player = Players:GetPlayerFromCharacter(TouchPart.Parent) --Get player from character model (if they exist)
if Player then --Check to make sure player exists
if StorageFolder:FindFirstChild(Player.UserId) then --Check if player actually has tools stored in a folder
Player.Character.Humanoid:UnequipTools() --Unequip tools to have them all in the backpack
--Destroy tools in player's backpack
for _, v in pairs(Player.Backpack:GetChildren()) do
v:Destroy()
end
--Restore old tools to player's backpack
for _, v in pairs(StorageFolder:FindFirstChild(Player.UserId):GetChildren()) do
v.Handle.Anchored = false
v.Parent = Player.Backpack
end
StorageFolder:FindFirstChild(Player.UserId):Destroy() --Destroy Folder as nothing is in it
end
end
task.wait()
Busy = false
end
end)