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

Can someone help with my CAS script?

Asked by
yoshiegg6 176
9 years ago

This is in a local script in a tool. It uses context action service to call a function when you press R, it clones a part from server storage and plays an animation and it doesn't work at all. The output says something is wrong with line 19.

Edit:Fixed errors and it still won't work.

--Normal variable setup
local player = game.Players.LocalPlayer
local char = player.Character
local debounce = false

--Setting up the animation 
local animation = Instance.new("Animation")
animation.Parent = script.Parent
animation.AnimationId = "http://www.roblox.com/Asset?ID=21488069"
local animTrack = char.Humanoid:LoadAnimation(animation)
--Context Action Service
local CAS = game:GetService("ContextActionService")

--Actual function I want to happen
function firewall()
if debounce then return end
local CF = game.ServerStorage.Wall:Clone()
CF.Parent = script.Parent
CF.MainPart.Position = char.Torso.Position + Vector3.new(5,0,0)
CF.MainPart.Rotation = char.Torso.Rotation
animTrack:Play()
debounce = true
wait(5)
debounce = false
end


script.Parent.Equipped:connect(function()
CAS:BindActionToInputTypes("wall", firewall, false, "r") 
end)

script.Parent.Unequipped:connect(function()
CAS:UnbindAction("wall")
end)

1 answer

Log in to vote
1
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

LocalScripts don't have access to anything in ServerStorage (clients don't get copies of things there -- this means when players connect they don't have to load these things, which can speed up joining).

Use ReplicatedStorage for things that LocalScripts need to have access to.

0
Will replicatedstorage have any adverse effects like starting scripts in the model? yoshiegg6 176 — 9y
0
Nope. It's exactly the same as ServerStorage, it just copies to clients so that LocalScripts can use models inside of it. BlueTaslem 18071 — 9y
0
It still doesn't work and I put it in replicated storage. yoshiegg6 176 — 9y
0
And changed the script. yoshiegg6 176 — 9y
View all comments (4 more)
0
Is there an error? Have you done debugging? This definitely solve the only error you told us about. I can't help you if you can't help yourself BlueTaslem 18071 — 9y
0
I've been debugging for a while. Now there are no errors but no output either so I don't know what to fix. yoshiegg6 176 — 9y
0
If you have been debugging, you would have gotten output -- you should be figuring out what is happening. Debuggin is *NOT* staring at code and just thinking. It's actually performing experiments. BlueTaslem 18071 — 9y
0
So how should I debug this? What can I test to make this work? yoshiegg6 176 — 9y
Ad

Answer this question