Hey developers
Recently ive been working on an update for my fighting game strife stadium and have been making a bear trap ability for a new character
But it dosnt appear to be working
Heres the code (Server)
-- local enabled = true
script.Parent.OnServerEvent:Connect(function(player,V1,V2)
if not enabled then return end
enabled = false
local trap = game.ServerStorage.BearTrap:Clone()
trap.Parent = game.Workspace.AntiMouse.Projectiles
trap.CFrame = V1*CFrame.new(0,0,-2)
trap.CFrame = CFrame.new(trap.Position, V2)
game.Debris:AddItem(trap,30)
wait(60)
enabled = true
end)
Local script
local UIS = game:GetService("UserInputService")
local c = game.Players.LocalPlayer.Character
UIS.InputBegan:connect(function(input)
if input.KeyCode == Enum.KeyCode.Five then
script.Trigger:FireServer(c.HumanoidRootPart.CFrame)
end
end)
Hope you can help
~Neptune
Looking at the code, you have it so it expects you to fire in 2 parameters, as it uses the 2nd thing, aka V2, but you only fire 1 thing, the CFrame of the HumanoidRootPart. Could that be related?
Im presming since i did kinda just copy some code from the projectile script to spawn in the bear trap
Ill test that in a bit thank you
1 Like
Alright its still not working the error says
CFrame is not a valid member of Model “Workspace.AntiMouse.Projectiles.BearTrap”
Im presuming i have to put the bear trap spawn multiple times in for each part,great thanks roblox studio very cool.
So the BearTrap
is a model? Can’t you use SetPrimaryPartCFrame
?
trap:SetPrimaryPartCFrame(V1*CFrame.new(0,0,-2))
And if you want to get the CFrame again for that 2nd bit, just use trap:GetPrimaryPartCFrame
or trap.PrimaryPart.CFrame
Ensure a PriamryPart has been set to the BearTrap model
Alright thanks but i already did each part and sadly its not working i think this may be a scrapped ability since it dosnt really fit a fighting game now i think
Also if anyone else sees this and understands rigging pls help with this
Help with rigging Ocean Goddess - Help and Feedback / Art Design Support - DevForum | Roblox
1 Like
That’s completely fine! Do whatever you feel would be a better decision as it is your game after all! If you ever consider adding it again, least you’ll know what needs to be done!
If you have anymore issues don’t be afraid to make another post!
Thank you for replying and helping im not to good at position in scripts and youve made coding my game so much easier now ik about primary parts!
1 Like