Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What are the problems with this shuriken tool code?

Asked by 4 years ago

I'm trying to make a game where you can throw a shuriken at a player then pick the star up again. I looked at the Roblox Wiki for BodyForce BodyPosition etc etc. I tried to test my star in the game but it didn't work. Here's my code:

local tool = script.Parent
local UserInputService = game:GetService("UserInputService")
local MousePressed = UserInputService/"IsMouseButtonPressed"
local LocalPlayer = game:GetService("Players")
local MousePosition = LocalPlayer:GetMouse("MouseHit")


BodyForce = 10
BodyPositionPIP = 10
BodyPositionDID = 10
BodyForceMaxForce = 10

if MousePressed then
    tool.BodyPosition = MousePosition 
end 

I know that it should be more complicated than this, so a little nudge would help.

2
check the console log and it will show you the script errors :/ User#5423 17 — 4y
0
What I mean is how can I fix the script. n00b_warri0r 11 — 4y
2
Check the console. Seriously. DeceptiveCaster 3761 — 4y
1
Use the console to find script errors, we can't just tell what is wrong Just_Moop 27 — 4y
View all comments (2 more)
0
If I had to guess, you're indexing tool for bodyposition, which probably isnt a valid member of tool.  Psudar 882 — 4y
0
It says "Argument 1 missing or nil"??????? n00b_warri0r 11 — 4y

Answer this question