I am trying to turn my character into something else mid-game but, the code I’m using is causing a bit of an issue; the code works fine but, I can’t use External or Intreal variables with it via a local script. I tried several ways and I keep hitting a roadblock so I’m wondering if there is other ways to turn the character into a custom rig. This is the code I’m using for it right now
local oldModel = player.Character
local newModel = model:Clone()
local moving = false
local idling = false
local RUN_SPEED = 32
local oldCFrame = oldModel:GetPrimaryPartCFrame()
player.Character = newModel
newModel.Parent = workspace -- this follows the current character loading behavior
newModel:SetPrimaryPartCFrame(oldCFrame)
2 Likes
You can use RemoteEvents to transfer things between client-side and server-side.
just make it in the server via a script
if you want to make all players have the same character all the times , just make the character then name it “StarterCharacter” and put in in the StarterPlayer
no, it’s only for one player the script is in the workspace, this is the local script, and the Z ability is not being fired when it gets to the Z part of the variable gets switched back somehow
But, if I take out the sever being fired and the character model changing the problem stops, so I’m guessing it’s the way that the character is being changed.
local RS = game:GetService("ReplicatedStorage")
local UIS = game:GetService("UserInputService")
local CubeShiftEvent = RS:WaitForChild("CubeShiftEvent")
local NVal = false
local CubeShiftEvent = RS:WaitForChild("CubeShiftEvent")
local model = game.ReplicatedStorage.StarterCharacter
--
local VoidShift = RS:WaitForChild("Void")
local isRunning = false
UIS.InputBegan:Connect(function(input,gameProcessed)
--print("Starting our connection with NVAL having the value of ", tostring(NVal))
if not gameProcessed then
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.E then
NVal = true
print(" has been set")
if NVal then
wait(.1)
CubeShiftEvent:FireServer(model)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.Z and NVal then
print("Nval Is",NVal)
else
print("nth")
end
end
end
end
end
end
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.Z and NVal then
print("Nval Is",NVal)
else
print("nth")
end
end
end)
1 Like
are you getting any errors in the output ?
not really sometimes it says It can’t find the child but that’s only if I spam E.
1 Like
where did you put this script ?