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

A Script that equips a tool OnTouch only works in studio and shows no errors in the player?

Asked by
PastDays 108
6 years ago
Edited 6 years ago

I made this script to equip a tool on touch as i have backpack disabled and only want the tool to be equipped when entering a specific area.

function onTouched(hit)
    if game.ServerStorage.Main.Values.ToolEquip.Value == 0 then
script.Disabled = true
hit.Parent.Humanoid:EquipTool(game.ServerStorage.Main.Parts.R15)
game.ServerStorage.Main.Values.ToolEquip.Value = 1
script.Disabled = false
    end
end

connection = script.Parent.Touched:connect(onTouched)

connection = script.Parent.Touched:connect(onTouched)

I spent a while getting this to work so any help would be appreciated. Thanks :)

0
There's a tutorial I followed that helped me out with this same problem. :) Try this - https://www.youtube.com/watch?v=m6Vt9u8uF94 Never2Humble 90 — 6y
0
That is different to what im doing, my game is an adventure/puzzle game, and when entering an area the tool (sword) will equip allowing the player to fight and when the player kills all the enemies set on him the weapon will Unequip. Thankyou for the help though :) PastDays 108 — 6y
0
Gotcha. :) Sounds like a pretty cool game concept! Never2Humble 90 — 6y
0
Thankyou i hope it pans out well i just really need someone to help me with this so i can carry on making it :/ PastDays 108 — 6y

Answer this question